Elektrine lite

← Feed

@pixx@merveilles.town

Post #1689790

2026-03-23 17:21 UTC

Something fascinating here: this is a codebase in C. It's not doing anything crazy by the rules of C. C is my preferred language, the one I'm best at. I understand every single line of code, on its own. But a lot of the high level logic feels weirdly foreign, moreso than typical Go code even. I can read the code and go "oh that's a hash table" pretty easily, and i get using a hash table to quickly identify cached blocks But the table is, implicit? Sorta? The heads of each "bucket" are stored in the cache, but there's no real bucket. Each block just has a doubly linked list to follow prev/next pointers which, sure, but then it also multiple other unrelated lists. Okay, not too crazy. But they're sorted by a fake ticker clock, except not entirely, only sorta quadratically? Which seems to just be a way to maintain a LRU in *yet another list* sorting the *exact same set* of *statically allocated blocks*. And, i can untangle all of this. It requires pen and paper ( or a .tex file), but it's a fascinating experience reading something, understanding what it means, but having no clue what it's doing

Replies (1)

  • @pixx@merveilles.town 2026-03-23 17:31

    What i mean is, it's kinda weird that even something as well defined as C can change so much in 20 years as to require basically relearning the idioms. It's also... kinda just an argument that this code is bad, tbh. Lots of Plan 9 code is this old, much of it uses similar patterns, little of it has ever taken me this much effort to reverse engineer...

    Open ##1689791