News for hackers. Stuff that matters.

Const-me

Re:Billion-query-per-second lookup tables in C++ on Wednesday October 28, 2026 @08:01AM (#50272228)
To my taste, that’s too many pointer chases and mispredicted branches.

I once needed something like that which was performance sensitive. Specifically, deserializer of a custom binary format which used string tags for stuff, essentially a tree data structure with string keys. I didn’t have too many of these keys, a key represents a serializable field of some C++ type.

I restricted length of the strings to 16 bytes which was good enough for my use case, and zero padded them into 16 bytes SIMD vector.

On x86-64-v2 and newer AMD64 CPUs, comparing these vectors for equality takes two instructions, pxor and ptest; _mm_xor_si128 and _mm_testz_si128 in C++. That includes the load because pxor can fuse loading of one of the arguments. Searching for a key is then a linear scan over a small aligned block of memory which during de-serialisation is guaranteed to stay hot in L1D. No pointer chases, no inner loops, 2 very fast instructions per test.

Re:Voxtral 3 on Tuesday October 20, 2026 @02:12PM (#50170351)
Their previous generation open weight STT model was pretty good.

I have recently launched commercial Windows software implementing offline inference of Voxtral Mini 4B Realtime on commodity hardware: https://vrmac-softver.com/speech2text It requires 4GB VRAM, and exceeds realtime rate on my “median” laptop with Ryzen 5 5600U iGPU. I’m currently working on a Linux port.

Re:SDF vs. MSDF vs. Slug: GPU Text Rendering on Wednesday September 30, 2026 @12:15PM (#49910847)
“What makes glyphs hard” Another reason is hinting. Traditional text renderers like FreeType are aware of the pixel grid and they adjust the curves slightly, snapping them to that grid. For all methods in the article quite hard to do on GPUs.

“Chinese, Japanese, and Korean have tens of thousands of glyphs, and baking all of them at several sizes is a memory disaster” One possible solution is dynamic atlas built on CPU for visible glyphs only.

“The distance-field panels notch, where interpolating between stored samples no longer matches the true curve” Can’t it be fixed in the shader, using screen-space derivatives of the SDF? I think in theory, SDF value for pixel center combined with screen-space gradient vector of that number delivers enough data to compute partial coverage for the pixels on the edge.

Re:If we do not stop to help each other, what do we become? on Sunday September 27, 2026 @07:46AM (#49865828)
> Can you name anything you've learned from an LLM?

Not GP, but here’s some of the things I have learned in the last couple weeks from LLMs while asking LLMs to review parts of my code and documentation. I wrote the code and documentation without LLMs.

Linux user permissions is a fake because by design, the owner has permissions to write these 3 bits. A good way to reliably deploy a readonly file is owner=root, assign the read permission to the group.

chown command follows links by default, -h switch disables that.

In Linux, resetting environment variable in a long-lived server process doesn’t erase much data because /proc/{pid}/environ is a snapshot taken on process startup.

If my server crashes (or manually killed by a root to test things on staging VM) and Alpine’s supervise-daemon restarts it, the start_pre() function from the OpenRC service script won’t be called again. A fix is use OpenRC to run a launcher shell script as root, in that script manually downgrade the account with `exec su-exec svc:svc /the/server/elf`

This last one is irrelevant to my use cases but still interesting. AES GCM may fail catastrophically when different message encrypted with same password and nonce. For 12 bytes of random nonce, the stuff is only safe up to approximately 4E+9 messages using the same password, beyond that birthday paradox ruins things.

I remember I once wanted to compute tangent of fp64 vectors. Here’s what I did.

https://github.com/Const-me/AvxMath/blob/master/AvxMath/AvxM...

See remark on the slide 11: https://www.servethehome.com/micron-evolving-memory-architec... That presentation is by Micron.
Re:OpenAI buys smartphone camera maker Glass Imaging for $300M on Tuesday September 15, 2026 @12:58PM (#49715403)
I wonder why hasn’t the OP forked postmarketOS or some other Linux?

I totally get why they wanted a custom userland, built it myself for embedded devices. But IME Linux kernel is not terribly bad these days.

I think nuclear winter is a fake invented by cold war propaganda. If tomorrow we detonate all nukes available, the amount of dust in the atmosphere won’t even approach a large volcanic eruption.

Volcanic eruptions occasionally inject literally cubic kilometres of stuff high into the atmosphere. That’s insufficient to cause a global winter, only a year without a summer: https://en.wikipedia.org/wiki/Year_Without_a_Summer

Re:Nvidia agrees to acquire Hugging Face for $13B on Thursday August 27, 2026 @07:04AM (#49462814)
For the last few months, I’ve been working on a vendor-agnostic inference library. Have 3 backends so far: legacy D3D11 for compatibility, D3D12, and Vulkan 1.3. I have reasons to believe nVidia deliberately crippling Vulkan API for their consumer GPUs. Couple examples to be specific.

nVidia driver sets quite low number for VkPhysicalDeviceLimits::maxTexelBufferElements. I don’t think that’s a hardware limit because I have D3D12 backend doing the same thing on the same hardware.

Vulkan performance is not great on nVidia. On all AMD cards I am testing, Vulkan 1.3 is the fastest backend. On nVidia however, D3D12 is faster despite tensor cores (WMMA / wave matrix multiply accumulate / cooperative matrices) are only available through Vulkan, D3D12 is using shader cores exclusively.

Re:SIMD in the 90s: Programming Intel's Pentium MMX on Sunday August 16, 2026 @05:03PM (#49323648)
I would add than SSE1 and SSE2 are now required parts of AMD64 instruction set. All 64-bit PC processors are required to support them both. For that reason, modern compilers are ignoring x87 FPU when building 64-bit binaries. Instead, they compile all float and double arithmetic into SSE1 and SSE2 instructions, respectively.
Before Vista, we did not have window previews in task bar and alt+tab. We didn’t have a good multimedia framework based on the hardware codecs: media foundation arriving with Vista wasn’t a coincidence. It was hard to capture and encode desktop for screen recording and presentations: despite MS only added desktop duplication API in Win8, technically Vista and Win7 graphics stacks could already do that, MS just neglected. Also, these aero translucency visuals in Vista and Win7 were nice, until Win8 ruined everything.

All that stuff would be hard to impossible with the older GDI architecture and no desktop compositor process.

“aren't truly using a fully shared memory pool” I think with AMD iGPUs I have here (GCN 5.1 and RDNA3 generations) it’s actually unified, at least on Windows 10. The difference between the reserved portion and the rest of the memory is cosmetic.

From Vulkan API POV, the reserved portion has device local and multi instance heap flags, the main heap doesn’t. However, the memory type is identical across all heaps, all of them have device local, host visible and host coherent property flags. And I can confirm VMA library from Vulkan SDK successfully allocates way more device visible memory than the size of that reserved portion.

There’s a reason why all modern desktop environments are designed the same way: power efficiency when multitasking.

Imagine you have 3 windows visible at the same time: a videogame rendering at the refresh rate of the display 144 Hz, a video player rendering frames at 30 Hz, and a text editor rendering blinking cursor at 2 Hz. Because the videogame wants to deliver frames at 144 Hz, the desktop compositor has to deliver the entire desktop at 144 Hz. Asking the video player and especially the text editor to also deliver frames at that frequency would be wasteful. Irrelevant for desktops with fast discrete GPUs, but directly translates to battery drain on laptops.

True, but many modern computers are using unified memory. On such systems all memory is almost equal, despite often reported differently.

For example, on my 5 years old laptop with integrated AMD GPU, windows 10 calculator in default state uses 33 MB system RAM, 9.6 MB dedicated VRAM. Maximized to FullHD screen, same app uses 36 MB system RAM, 13 MB dedicated VRAM. Maybe the OS counts VRAM as active private working set, maybe the app uses more than 1 buffer.

Regardless of the reason, it’s IMO unrealistic to expect a modern GUI app to consume less memory than required for the frame buffer for its window.

10 MB is not too bad for a GUI app. If the app is full screen, display is FullHD and has 8 bit depth, that's almost 8 MB memory for the back buffer alone. Enable HDR and pixels become 8 bytes RGBA16_Float instead of 4 bytes BGRA8_Unorm, twice as much memory.
Re:Is it time for a new Embedded Linux build system? on Monday June 22, 2026 @08:43PM (#48638631)
I agree. In the past, I have successfully used Debian and Alpine for embedded. Never needed to compile OS kernels or standard DLLs, other people already did and published in these package repositories.
Why is that HEVC video extension is required?

As a part of the user-mode half of the GPU driver, GPU vendors ship media foundation transform DLLs to use HEVC hardware codecs. Don’t AMD, Intel and nVidia already pay patent royalties? I expect them to include into price of the GPUs with hardware support i.e. all of them made in the last decade.

Re:Satellite reveals immense scale of GPS signal tampering on Saturday June 20, 2026 @01:53PM (#48611317)
> typical crystals in the 10-100MHz range

I think most quarts watches oscillate at 32 kHz = 2^15 Hz, high precision quartz watches at 8.4 MHz = 2^23 Hz.

> The actual problem is stability over temperature

Apparently, designers of these watches compensating for that somehow: https://en.wikipedia.org/wiki/Quartz_clock#Thermal_compensat...

> benefits from being kept at constant-ish body temperature

Some people take off their watches every day before going to sleep.

These high-end quartz oscillators are probably too expensive to use in commodity computers. Still, the cost shouldn’t look too bad when compared to a price or an airplane, marine vessel, or most military equipment.

Re:Satellite reveals immense scale of GPS signal tampering on Saturday June 20, 2026 @01:13PM (#48610937)
> A typical PC clock is +/-100ppm. After 1 hour that's 0.36s

Are you confident in these numbers? They add up to 52 minutes of drift/year.

Good modern quartz watches specify 5 seconds/year drift, almost 3 orders of magnitude better.

Re:What every coder should know about Gamma Correction on Tuesday June 16, 2026 @12:08PM (#48557472)
> On which image does the gradation appear more even? It’s the second one!

Can’t reproduce. Tested on two monitors on my desk, designer-targeted Benq and cheap laptop. On the Benq, darkest 3 segments are indistinguishable, the 4-th one barely distinguishable. On the laptop, darkest 4 segments are indistinguishable, the 5-th barely distinguishable. However, on the “emitted light intensity” all bars are clearly visible.

> Image resizing

“Unsurprisingly, C gives the correct result” On my computers B very similar to A, just a tiny bit darker. While the “correct” C result is a lot lighter than A.

Also from the same section:

> B the result of resizing the pattern by 50% directly in sRGB-space (using bicubic interpolation)

Bicubic interpolation is only applicable when enraging images; downsampling is very different problem from interpolation.

Re:Hetzner increased dedicated server prices 3-4x on Monday June 15, 2026 @03:50PM (#48546158)
“Is it because of government regulations, do we need to deregulate?”

Insufficient law enforcement. The same memory manufacturers already broke antimonopoly laws in the past, pleaded guilty. Apparently the fines were too small for these companies to care, and the people responsible were promoted instead of being punished. More information: https://en.wikipedia.org/wiki/DRAM_price_fixing_scandal

Re:Making Graphics Like it's 1993 on Friday June 12, 2026 @07:29AM (#48502752)
On modern processors, floating point addition often has equal performance to floating point multiplication. For example, on AMD Zen4 it’s 3 cycles latency and 0.5 cycles throughput.

I’m not sure that trick going to work in the context of computer graphics. To transform vectors or multiply matrices you need a mix of multiplications and additions, or an equivalent sequence of FMAs.

Might be jurisdiction. Let’s say a person who is not a Polish citizen committing and broadcasting a crime outside of Poland, then trying to enter Poland. IANAL but I think this law sends that person to jail as long as the video is accessible from inside Poland.
Re:Making Graphics Like it's 1993 on Thursday June 11, 2026 @08:28AM (#48489419)
> let alone more performant

Not anymore. On modern hardware, the only operation where integers win is single cycle add/sub. For the rest of operations (multiplication, division, square roots, etc.) floating point is faster, sometimes by a lot.

Re:Lies We Tell Ourselves About Email Addresses on Wednesday June 10, 2026 @10:02AM (#48476460)
Good article. Worth noting C# standard library handles most of that complexity, no regular expressions required. Call System.Net.Mail.MailAddress.TryCreate, if successful read Address property to find the normalised address.
Re:Premature Optimization Is Fun Sometimes on Wednesday June 10, 2026 @09:46AM (#48476222)
Cool trick, but personally I don’t trust C bitfields. When I need something like that, I usually create C++ class or C# structure with a single private uint64 field, and public methods to extract or manipulate the logical fields.

Because the class/structure only has a single uint64 field, the compilers are likely to pass value in a single general-purpose register. I believe that’s unlikely to happen for a structure with bit fields.

If you target AVX2 or newer you also have BMI1 and BMI2, intrinsics like bextr and bzhi are probably faster than whatever codes compilers are generating for bit fields.

Binary compatibility of bit fields is a moot point, using them at the API surface across compilers or languages is not ideal. A structure with a single uint64 field is very compatible.

Re:What was your "Oh Shit" moment with GenAI? on Friday June 05, 2026 @07:42PM (#48419817)
None so far. When I try to use these language models in the primary areas of my expertise like SIMD or GPGPU they fail to do any good. When I ask them to implement some general-purpose stuff, the output is too low quality to be useful in my software.

Still, find them incredibly useful for code review (despite unable to write good C++ or C#, smart enough to detect issues there), also dealing with technologies outside of my area of expertise like Python or web stuff.

Re:Dav2d on Sunday May 31, 2026 @04:05PM (#48349230)
> Performance should not be priority #1. Security should be.

For a web browser, or a server in a bank, sure. For anything else, questionable.

> adding a sandbox around a memory-unsafe codec is going to be way more expensive

In modern world, overhead of strong sandboxes is surprisingly small. A nuclear but most reliable option is hardware assisted VM. On modern computers with SLAT and virtualized IO the overhead for most use cases is negligible. If you want something lighter weight, can use a multi-user nature of all modern OS kernels and isolate into a separate process with restricted permissions. Sandboxing overhead is approximately zero.

Re:What it takes to transpose a matrix on Tuesday May 26, 2026 @10:49AM (#48280627)
The AVX2 SIMD version is not ideal. Too many instructions, and it needs constant vectors. I would rather do it like that https://godbolt.org/z/cn6YKbfYd
Re:Making Deep Learning Go Brrrr from First Principles on Sunday May 24, 2026 @02:56AM (#48255110)
> decode (GEMV) is memory bound

Decode with batch size 1 is GEMV. Batching makes the decode GEMM too.

Older »