2,137 karma · joined May 21, 2020 (6y ago) · 458 submissions
https://boricj.net/
comment 1d ago · link · parent
They just std::map and AoS and dynamic dispatch everywhere and then grumble "100% CPU usage" when troubleshooting performance problems with top. They might reach for a profiler once all hope is lost, but wouldn't know what to make of performance counters if I showed them some. People who have mechanical sympathy are the exception, not the norm.
Now, if I were to design a NUMA-aware programming model, I would probably expose paired processors and memory pools. Then, create threads assigned to processors and hand them an allocator, like how Zig manages memory allocations.
Sadly, a global heap (malloc/new) and nothing else is standard and that's one of the many, many legacies of 1970s Unix and POSIX we might not be able to get rid of... Most code nowadays either uses it directly or has bespoke hoops to let the user supply a different heap.
comment 3d ago · link · parent
On a cold cache, you pay for each level of indirection, so you want to increase fan-out as much as possible. B-trees do that intrinsically.
comment 1w ago · link · parent
Between the VUs, the R5900's SIMD (MMI), the GS and the I/O buses (FireWire, Ethernet, IDE, Memory Cards...) to stream model weights, the smallest Bonsai models (or aggressively quantized Qwen3.5-0.8B) and some really cursed programming might just eke out something the PlayStation 2 has no business running.
comment 2w ago · link · parent
Personal project? Take all that you've learned in CS 101 and throw it into the trashbin; welcome to Mad Max-driven development, where ABIs are but a suggestion and you might accidentally end up presenting a poster at ACM CCS as a hobbyist (true story).
comment 2w ago · link · parent
I've had decent results with gemma4:26b (although it's more like batch processing when used as a coding agent) and my experience so far is globally in line with the first two sections of the ARCHITECTURE.md: fast with small contexts but performance degrades fast as its size increases. If the rest of the contents of that document are true, I'll need to retune my setup from scratch.
comment 2w ago · link · parent
I've had to debug both Mbed-TLS and OpenSSL in parallel to figure out a bug in that PR by finding out the point of divergence between the two. The former was a good time, the latter very much not so.
I can only speculate as to why the long-term support of Mbed-TLS 4.1 (which was supposed to last until March 2029) was effectively recanted, but maintaining an internet-facing TLS/X.509/PKCS library in the age of LLM doesn't sound like a good time...
comment 2w ago · link · parent
I've made a PR a while back to add support for authenticated attributes and chain certificates (https://github.com/Mbed-TLS/mbedtls/pull/10232), turns out there are several open PRs for that feature set over the years and they just all sit there. That doesn't inspire contributors to stick around.
comment 3w ago · link · parent
Object pools, with indices and generations. Way, way easier than meddling with raw pointers, cheaper than shared_ptr/weak_ptr and no clean-up required when deleting stuff because the stored generation won't match the new object's generation. You can even make that default-constructible if you increment the generation on instantiation too (so that only even generations are alive) and hide it all behind high-level abstractions with C++.
Though my knowledge of these techniques come from 2000s video game architectures, as games like GTA: Vice City are known to use it.
comment 3w ago · link · parent
"Unclean" code for this is putting objects in a table, giving objects a generation (that increments whenever you create/delete one) and storing pairs of (index, generation) numbers everywhere you need a link. Link is live only if the generations matches and since only odd generations are live objects, default construction means no link. Lifted straight from 2000s video game tricks and with modern C++ it's basically all encapsulated away.
I've made that refactoring in a codebase, not because of speed but because of maintenance and memory fragmentation concerns. Sometimes, the clean solution really isn't the right one and it's really sad that compsci only ever teaches classical data structures, like we're still coding in the 1970s on computers with no caches that don't suffer from pointer chasing.
comment 3w ago · link · parent
That's the least forgiving kind of chip when it comes to performance: fast enough to outpace main memory by two orders of magnitude, yet the slightest speed bump (branch misprediction, cache miss) stalls it without any ability to reorder around it.
comment 3w ago · link · parent
On the other hand, in my team I wrote my custom C++ STL containers that allocate inline, SAX-style processing libraries and an object pool with links that use index+generations like 2000s video games... on a STM32H5 with less than a megabyte of RAM.
Mechanical sympathy feels like a lost art to people I demonstrate it to... and I had to demonstrate to the first team with benchmark numbers that I would not be the bottleneck between us by orders of magnitudes.
comment 4w ago · link · parent
Word-of-mouth happens when someone who has a need finds your project, uses it and likes it so much they talk about it to other potential users. It's effectively a chain reaction and the way to leverage it is to make something people want to use.
comment 4w ago · link · parent
In fact, I see this as an opportunity to build anew and better. When you're no longer constrained by legacy baggage and constraints, you can collapse layers and introduce new ones that better fit what you're creating.
I'm doing that in the project I'm working on at work. Being able to redefine how serialization/deserialization fundamentally works and interacts with domain objects is giving us unbelievable expressiveness, not by the amount of code written (in fact, it's heavily factorized across layers that were historically separate), but by exploring new designs paradigms.
Don't just read these books. Write some new ones.
comment 1mo ago · link · parent
Say, like a multi-scale hierarchical half popcount vector (first/second half, first quarter+third quarter/second quarter+fourth quarter down to odd/even bits), where fumbling one private key for another or xkcd-ing 4 as a private key would be detected, but still reveal no information on a truly random series of bits and be understandable by non-technical people in the room.
comment 1mo ago · link · parent
You could ask the same about the Opinel No. 8 knife. Same thing since 1890s, one minor update every 50 years or so. It's still sold by the bucketload today for about €10.
It's just French, the same way a Lada is just Russian, a Mini Cooper is British or a Fiat 500 is Italian. It's part of post-WW2 cars that were cheap to buy, cheap to operate, cheap to fix and with production numbers in the millions.
comment 1mo ago · link · parent
I'm working on an embedded system with a MCU and I've benchmarked JSON serialization at over 500 KiB/s (through a HTTP GET request) using my own library. Deserialization is slower, but that's partly because I have super-linear algorithms downstream of the parsing.
CBOR is much nicer and faster to work with (smaller documents, definite length strings directly consumable) and I do support it in my library, but I derive most of my performance gains by ditching DOM-style APIs and using stream processing instead. Allocating nodes and chasing pointers all over the heap sucks for performance, especially for large documents, regardless of the format (and that's assuming it even fits within available RAM).
comment 1mo ago · link · parent
Humans too do that for matching decompilation. Or at least I imagine so, given that I personally refuse to do that.
People have different goals and will use different techniques to achieve them. The video game reverse-engineering/decompilation community isn't a hive-mind, I went ahead and created ghidra-delinker-extension because I had my own ideas on how to do that.
comment 1mo ago · link · parent
The quirks of that console for this is that the CPU takes a 6 cycle stall on any read from main RAM (it's not even stall-on-use) and doesn't have a data cache. That would make it a very poor fit for this, so I had to improvise a bunch of tricks to reclaim performance:
- Made all of my hot loop fit within one function, so that it fits entirely in the 4 KiB direct-mapped instruction cache (so less than 1024 instructions)
- Wrote a C++ template that can trampoline a function call into the 2 KiB scratchpad
- Used the rest of the scratchpad for a CLUT table because it doesn't stall on read
- Used the GTE to transform the N set of coordinates while the CPU stalls fetching the N+1 set of heightmap data
- Figured ways to abuse the GTE into transforming more points per instructions than it theoretically can, taking advantage of simplified formulas compared to real 3D projection
- Write the rectangle primitives straight to the GPU registers instead of going through a display list
It's such an abuse of the PlayStation that PCSX-Redux and DuckStation disagree on its performance by up to a factor of two. I should finish it someday and see how it runs on real hardware...
comment 2mo ago · link · parent
At home, ghidra-delinker-extension [1], a Ghidra extension for exporting relocatable object files (or in other words, stripping programs for parts like Doctor Frankenstein). Absurdly complex, got me a poster session at SURE workshop at ACM CCS last year, as a hobbyist.
comment 2mo ago · link · parent
It's the vindication of Gaullism half a century after De Gaulle's death, the concept of strategic autonomy is getting traction in the rest of Europe. It's not that we can't be friends, but that we shouldn't let our future be gambled in the hands of Wisconsin voters every two years.
comment 2mo ago · link · parent
I recently implemented a custom C++ container for a path whose components could be iterated, backed by a std::string. I just store indices and a reference to the string, such that my iterators are not invalidated if the std::string gets reallocated after being modified. Far less error prone for little added cost.
comment 2mo ago · link · parent
The first two formats I've implemented as fully streaming, the serializers emit into an output iterator one character/byte at a time and the deserializers only need to hold one value at a time (mostly for strings, and not even for CBOR's byte arrays, which are streamed). BSON requires full document instantiation because of byte offsets and is genuinely anti-streaming in its design.
I happen to have implemented a serializer for YAML, fully streaming, mostly as a compact-ish human-readable debug data representation. I can scarcely think of fates worse than having to write a spec-compliant YAML parser.
comment 3mo ago · link · parent
I've already seen the horrors that lurk inside of poorly-written 90s video games. Hard pass.