Better HN
topnewbestaskshowjobs
Log inSign up

laladrik

64 karma · joined Jun 8, 2020 (6y ago) · 35 submissions

barber-stoic-come@duck.com
Submissions

comment 4mo ago · link · parent

SDL3 has been around for 1.5 years. I can't help but wonder about the choice of SDL2 over it. I started using SDL from its 3rd version. Don't I know about some advantages of SDL2?

comment 4mo ago · link · parent

It's fair to mention that DOD is not only getting the most out of the hardware. It also allows the busy work to be avoided. I caught myself a couple of times, when I wanted to make a set of types united by some interface. However, in reality what I could do (and I did eventually) is having several instances of single SOA (one per type) which were processed differently. The addition of a new "type" turned from a good hundred line patch to 20-30 lines

comment 4mo ago · link · parent

Have a look at the talk Practical Data-Oriented Design by Andrew Kelly [1]. He covers the following techniques:

1. Indexes instead of pointers. This allows you to avoid alignment of 8 bytes in your structure for x86_64.

2. Storing booleans out-of-band. Booleans cause padding all the time.

3. Struct of Arrays. Based on your question I assume you're familiar with it.

4. Store sparse data in hash maps. I remember one time when it allowed to eliminate inheritance.

5. Encoding the data instead of OOP/polymorphism. I haven't got an occasion to use it. The idea is to add extra tags to avoid boolean properties.

[1] - https://vimeo.com/649009599

comment 5mo ago · link · parent

you're right. The problem is with my Android application. Clicking the link through the website leads to a page

5.

Ask HN: Switching from backend development to graphics programming

1 points · by laladrik · 5mo ago · discuss

comment 5mo ago · link · parent

I'm surprised that Vim is not on the first place here. Great TUI application. However, the about the TUI applications which I use is extensibility. For example, FZF is just a picker, but it has a ton of extensions. Another TUI I like is the interactive mode of Khal (calendar). However, apart from TUI it allows to be used through CLI which allows you to make your scripts on top of it.

comment 5mo ago · link · parent

The link is 404

comment 5mo ago · link · parent

When I was a student I had to make quite a few Qt application with C++ (for Linux). However, I bring the food on the table doing web (recently only the backend). During that time, the languages for web were something like Python - concise, convenient in terms of ecosystem and distribution, but bloated in terms of memory consumption. "Hello World in Java almost doesn't hang" he-he. Anyway, my first thought when I found Rust I dreamed to make a GUI application.

Unfortunately, I had the expectation that it should be as simple as making an HTML page. My failure to find a library or a framework to make GUI application made me learn a lot about how GUI works. I realized that making GUI for browser and for desktop are quite different problems. Browser makes easy what's difficult having a desktop oriented GUI framework - text rendering. However, the situation is fair the other around. GUI framework makes easy what's difficult in a browser - drawing arbitrary shapes. As a result, a web-frontend programmer struggles to figure out how to write some text having something like Qt, a GUI programmer tries to find the API to the bitmap in a browser.

It's fair noticed in the previous comments that a GUI framework brings a lot. That's because the problem is complex:

1. Create a window

2. Communicate with the window compositor (you do in WinAPI too btw). How to access the system tray and the child window.

3. Communicate with the operating system.

4. Handle the user input. Callback vs event streams. The user has 4 keyboards for some reason.

5. Rendering. Subpixels, shapes, different DPI. The user has 6 monitors.

6. Text rendering.

7. Widgets. Where probably the most difficult part is to make a textbox, because it involves the solutions of all previous steps.

The steps above touch only the visual part. There's also audio, accessibility, somebody wants the GUI framework to solve the networking.

After all of this research, I picked simply SDL for my project.

1. It's easy to compile.

2. It's small.

3. It relies on the subjectively common dependencies.

4. It's fairly straightforward to upgrade. Given that, you have to create a lot from scratch the part with updating is smaller comparing to a Qt-based solution.

5. It has batteries. My favorite is SDL_ttf which allowed me recently to implement selection of the text which is quite a bit through towards a textbox.

Having a project on SDL requires a lot of knowledge, but not a lot of code.

comment 5mo ago · link · parent

This one looks good to me. https://matklad.github.io/. Coincidentally the author has recently posted about CSS for blogs https://matklad.github.io/2026/06/04/css-unavoidable-bad-par....

I have my own blog, but I'm unhappy with its design as well; therefore I'm not sharing it. Nevertheless, I find particularly challenging two things: 1. Make tables readable from a smartphone. There are a few tricks which allow you to make a responsive table. However, those tricks implies that you use <ul> or <div> instead of <table> which defeats the point of having a table. 2. I had an article where I needed to put a tiny mind map. Eventually I put it as a picture, because the solutions to draw a mind map with JavaScript made the page as twice as heavy.

comment 5mo ago · link · parent

    Location: Ireland
    Remote: Yes
    Willing to relocate: No
    Technologies: Rust, Go, C/C++, Postgres, RabbitMQ, Redis, GNU/Linux, Docker, Python.
    Résumé/CV: https://alexmarkov.xyz/resume-long.html
    Email: barber-stoic-come@duck.com
Senior Software Engineer with 15+ years of experience with strong system design skill. Deep knowledge of GNU/Linux to build high-load web systems serving millions of requests.

comment 9mo ago · link · parent

You know, that new inline Vim's diff algorithm looks really tempting. I wish I had it in my Neovim

comment 9mo ago · link · parent

Well, the article is old, but it's good enough to deserve one more link to it :)

comment 9mo ago · link · parent

Keep working on a GUI calendar for Linux which would CLI users happy to use https://semana.alexmarkov.xyz/. Just recently I've shaped the architecture a bit.

comment 11mo ago · link · parent

During the last couple of years working on Rust programs I collected a number of GDB scripts. Eventually, they evolved into the project. Also, I wrote an article about how I came up with each of the scripts https://alexmarkov.xyz/blog/rustToolsGdb.html

15.

RustToolsGDB(codeberg.org ↗)

1 points · by laladrik · 11mo ago · 1 comment

comment 11mo ago · link · parent

That's a good introduction. There is a video which I'd say complements the article. It's called "Getting pixels on screen on Linux: introduction to Kernel Mode Setting" [1]

1. https://www.youtube.com/watch?v=haes4_Xnc5Q&list=PLz9LbZJP-T...

comment 12mo ago · link · parent

Recently Khal [1] released JSON interface. In short, Khal is a Linux CLI calendar application. I'm working on a proof-of-concept GUI[2] for the interface. I expect to implement typical views for a calendar application: daily, weekly, monthly.

1. https://github.com/pimutils/khal

2. https://codeberg.org/laladrik/Semana

comment 12mo ago · link · parent

The conclusion of the article says that it's not the language problem either. Under the title "So, is Go the problem?" Or do you mean something else here?

comment 1y ago · link · parent

Yeah, that's a pity that D didn't gain the popularity. It brought some features which were borrowed to mainstream languages. However, the features didn't help D to become popular. I have a hunch that templates from D were the inspiration for the comptime in Zig. Also, Reading D is almost easy as reading Zig. I remember I couldn't get my head around async/await from Python 3.5. I knew it was based on generators. However, the stack switch was absolutely mysterious to me. I understood it only from the implementation of fibers from the D's standard library.

comment 1y ago · link · parent

Hello everyone, I started programming because I wanted to make games. However, I got a chance to bring the food to the table making on web sites. A few months ago I came across a list of challenges for a programmer. One of challenges was creating a clone of Space Invaders. I created a clone of the game and wrote the article. In the article I wrote about the challenges related to gamedev which I faced. With gamedev background I wouldn't have them, I guess. However, for me as for a backend programmer, they were something. I hope the article is good enough to inspire other programmers like me to complete their first games.

21.

My First Complete Game(laladrik.xyz ↗)

6 points · by laladrik · 1y ago · 1 comment

comment 1y ago · link · parent

Hello, I've been playing with Zig the last couple of months. The navigation between document symbols in Neovim is a bit complicated the document has symbols with the same name. I improved it adding the path to every symbol. For example you have two structures:

    const App = struct {
        fn init() @This() { return .{} }
    };

    const Connection = struct {
        fn init() @This() { return .{} }
    };
You get the following items in the navigation list:

    App::init
    Connection::init
Essentially, it's a configuration of Telescope and Nvim-Treesitter. You can take the file from here https://laladrik.xyz/zig_document_symbols.lua. However, if you curious about the process of creating a custom Telescope menu and inspection of the source code with Tree-sitter, checkout the entire article.

Also, while I working on it, I found that LuaJIT 2.1 compares strings as fast as integers. Eventually, I did a little research about it and published the results here https://laladrik.xyz/blog/luaStringComparison/

23.

Enhanced document symbol menu for Zig(laladrik.xyz ↗)

3 points · by laladrik · 1y ago · 1 comment

comment 1y ago · link · parent

I fail to see the reference to be honest. I remember the term from OpenGL, when I rendered something to a framebuffer (actually its attachmets) and then applied to the current framebuffer. It helped me to do effects like night vision. Does using offscreen rendering imply using OpenGL?

Does GPU rendering mean that I have to involve OpenGL/Vulkan?

comment 1y ago · link · parent

A clear. I hid it in my mind. I haven't tried the approach with indices, because... well, I was lazy to do it. However, I agree that this approach would be better, then the current one.

> You describe that attempt in detail.

I appreciate if you put a quote, because I fail to find the description of the attempt in detail. In fact, instead of assuming that a vector is pinned I wrote this "I realized that the problem is related to the fact that vectors of children move in the memory if they don't have enough space to extend."

> The code you ended up with is still dangerous code, because your boxes are still not guaranteed to remain pinned in memory.

You are right, boxes are not pinned, but the data, which the point to, is pinned, isn't it? My pointers point to that part of memory.

comment 1y ago · link · parent

Ok, now I remember what was the deal with Hotspot. It makes it possible to work with a flamegraph of mine. However, it takes almost half a minute to load my perf.data. However! I totally recommend Hotspot over my hack in case when you need to have a comprehensive view of the data. In particular, I love to see the off-CPU load, which my FlameGraphViewer doesn't show.

comment 1y ago · link · parent

> The author isn’t talking about implementing an ECS or b-tree here.

Do you mean that b-tree might work here better?

> They’re just populating an array from a file when the program launches, then freeing the whole thing when the program terminates. It’s really not rocket science.

That's exactly why I consider indices.

> since they assumed memory allocated by vec would be pinned (it isn’t)

Could you tell me, please, where you read in the article that I assume it? I wrote in the article "I realized that the problem is related to the fact that vectors of children move in the memory if they don't have enough space to extend." and even made an animation for clarity https://laladrik.xyz/VectorMove.webm. However, if you see the assumption in the article, please, let me know. I correct it or elaborate.

comment 1y ago · link · parent

> please just let Xlib die

I don't have arguments against the point about Xlib. However, I struggle to use its alternative XCB. XCB doesn't have enough documentation to understand how to use it. In fact, I even looked at the source code of Qt and GTK, but the usage doesn't explain the XCB API. I'd really appreciate if you share with me the data you have. The only thing which I found recently is the wrapper from System76 https://pop-os.github.io/libcosmic/tiny_xlib/index.html. However, it's not a documentation still. I just hope to find some usages of the wrapper and communicate with the original API.

> if you ignore the existence of Wayland

How did you conclude it? I even mentioned it in the article. I don't use it - it's true. However, I can't wait to do it. I've been trying for a couple of years now. Regrettably, I experience various technical difficulties every time. As a result, I still use my i3.

> For something like fast visualizations, you should really go with something that does offscreen rendering and then blits the result.

Do you mean double buffering?

> though obviously modern tools should use GPU rendering

Would you mind elaborating on it?

comment 1y ago · link · parent

Unfortunately, I can't find the original perf file I get the flamegraph https://laladrik.xyz/img/pic.svg out of. However, I can create with a similar bunch of data and provide it soon.
12