Recent stories
Each story's summary, with the places it was discussed.
Summaries are written by AI from the linked sources. Open the source for full context.
littlefs is a file system designed for 32-bit microcontrollers, prioritizing power-loss resilience, wear leveling for SPI NOR flash, and bounded RAM/ROM usage.
It combines logging and Copy-on-Write techniques to achieve efficiency and atomicity, using CTZ skip-lists for data storage and metadata pairs for updates, ensuring reliability on memory-constrained devices.
The article builds a basic string type in C with a heap-allocated struct containing a char* buffer, current length, and capacity. string_new() rejects NULL, calculates storage for the text and terminator, allocates memory with malloc, copies the text, and returns the struct. string_free() releases memory and resets fields.
The example prints “Welcome King Nyaomaru!” and notes that the design can be extended with append, prepend, and resize operations.
An analysis of 40 major C projects finds that manual malloc/free remains dominant, but higher-level strategies are widespread.
Eight projects use only manual allocation; 16 are primarily manual, including SQLite (100%), curl (94%), Redis (79%), Linux (71% manual, 29% regions), and QEMU (86% manual). Seven primarily use regions, five garbage collection, and three reference counting; CPython leads the latter at 85%. Linux and QEMU also use scope cleanup extensions.
Enum-to-string functions implemented as switches can be optimized into lookup tables, but pointer tables consume space and relocations.
Concatenating strings and storing 16-bit offsets reduces size; an even smaller representation approximates each offset as x * 17 and stores only signed corrections in the range [-9, +10]. The technique computes an exact result through a fast approximation plus corrections, highlighting a useful optimization that compilers may miss.
Tailslayer is a C++ library designed to mitigate DRAM refresh-induced tail latency by replicating data across independent memory channels.
It utilizes hedged reads to fetch data from the fastest responding replica. The library supports customizable signal and work functions, providing developers with a high-performance tool to optimize memory read operations on hardware platforms like AMD, Intel, and Graviton.
Cranelift gained 128-bit atomic support for its AArch64 and s390x backends, enabling rustc_codegen_cranelift to compile Rust’s standard library without patches.
The AArch64 implementation uses exclusive-load/store retry loops (`ldaxp`, `stxp`/`stlxp`, and `cbnz`) to provide WebAssembly’s required sequential consistency for load, store, CAS, and RMW operations. The work required new ISLE lowerings, register-allocation constraints, instruction encodings, tests, and debugging. Support shipped in Cranelift 0.138.
An investigation found rare subnormal-value rounding bugs in Rust’s f32 FMA fallbacks and musl libc’s fmaf(), affecting systems without hardware FMA, especially older Intel and 32-bit ARM.
A formally verified SIMD emulation algorithm was corrected, exposing related Rust, musl, and compiler issues. fearless_simd is fixed; upstream patches and reviews remain ongoing, with possible simulation-accuracy consequences.
LLVM 23 reduces -O3 compile time by 6.75% (10.53% for sqlite3) through faster hash tables, SmallVector, dominator trees, successor/predecessor iteration, metadata handling, block numbering, and other IR changes.
GlobalISel improvements narrow its AArch64 -O0 gap with FastISel. Startup costs for shared libraries were reduced, while precompiled headers cut LLVM/Clang build times by about 45%.
Commit 818bebe fixes Linux drm/xe VRAM allocation by rounding the flat CCS storage boundary down instead of up.
The previous calculation exposed compression metadata as usable VRAM, allowing hardware writes to corrupt page tables and repeatedly crash the compositor, causing black screens on Battlemage G21. It also replaces an ineffective debug assertion and is marked for stable.
Rust-to-WebAssembly builds can become dramatically slower with full DWARF debug info because LLVM’s WebAssembly Register Stackify pass repeatedly rescans growing DBG_VALUE records, causing near-quadratic work.
A proposed LLVM patch makes targeted scans and cheaper position checks, reducing a 50-second reproducer to 2.72 seconds and cutting real-world cryptography code-generation time substantially.
The State of Garnet 2026 report outlines the development of a low-level, borrow-checked programming language designed as a simpler alternative to Rust.
Key updates include progress on a new type checker based on System F and research into integrating the 1ML research language principles to handle generics and traits as plain structs. The author detailed advancements in pattern matching through a unique conditional syntax and the implementation of 'properties' - a form of effect types used to prove code characteristics like panic-freedom. Despite facing significant complexity in type theory and undergoing multiple rewrites, the project continues to focus on pragmatism by favoring explicit annotations over global type inference and avoiding subtyping to maintain robustness and speed.
Solod is a systems programming language that functions as a strict subset of Go, transpiling directly to readable C11 code.
It eliminates hidden memory allocations and garbage collection, favoring stack allocation and manual memory management. Designed for native C interop, it retains familiar Go syntax and tooling while providing control and performance reminiscent of C.
Hare 0.26.3 was released with bug fixes and new language and standard-library features, including if..let expressions, flexible hare.ini module configuration, improved match-like semantics, @defined expressions, X.509 parsing and validation, filesystem statistics, and IPv4/IPv6 multicast support.
It is compatible with qbe 1.3, but has breaking changes including splitting rt:: into rt::, sys::, and arch:: and several API changes. The next release’s mutability overhaul is expected to break virtually all Hare code.
The post derives the bitap (shift-and) string-matching algorithm from naive and streaming approaches.
It represents active pattern-matching states as a bitset, shifting and masking it for each input character. Bitap is elegant and efficient for patterns shorter than a machine word, but offers limited gains for longer patterns or one-off searches due to preprocessing.
This guide explores low-level eBPF development without using standard libraries like libbpf or LLVM.
Using Zig, it demonstrates raw bytecode manipulation, the bpf syscall, and eBPF maps. It also covers BPF Type Format (BTF) implementation, subprograms, and calling KFuncs by parsing vmlinux for manual verification and loading.
Arena allocators simplify and accelerate memory management in C by grouping allocations with similar lifetimes into large regions that are freed or reset together.
The implementation uses an arena containing data, size, and used fields, with aligned allocation, optional reallocation by copying, and clear/free operations. Passing an arena explicitly makes allocation visible to callers and lets them choose the memory’s lifetime, reducing individual malloc/free calls and leak risks; a string-conversion example demonstrates the pattern.
A guide to using eBPF at the bytecode level in Linux without high-level libraries like libbpf.
It covers BPF instruction sets, constant string maps using Zig, and the complexities of BPF Type Format (BTF) required for subprograms and KFuncs, providing a low-level understanding of kernel verification and execution.
Centralized cleanup with a forward `goto` can provide C with a practical analogue to `defer`/`errdefer`.
Instead of duplicating resource-release logic across error branches, the function jumps to one cleanup label that frees all successfully allocated resources, using initialized pointers and optional multiple labels for partial cleanup. The approach improves readability and reduces maintenance bugs; it is also documented in the Linux kernel coding style guide. The author additionally notes using `calloc` when allocation-size multiplication might overflow.
FreeBSD’s GUS (Global Unbounded Sequences) provides safe memory reclamation for lock-free data structures using unbounded per-CPU sequences instead of bounded epochs.
CPUs publish sequences while pinned; polling finds the minimum across CPUs, allowing retired memory to be reused after all readers pass the relevant point. Its integration with UMA’s bucketed allocator amortizes polling across batches. Apple’s XNU uses a related design with preemptible read sections and recirculation depots. GUS is simpler and can reduce reuse latency, but fences and polling remain costly.
An advanced guide to optimizing C on Playdate for emulators, simulations, renderers, and codecs.
It emphasizes the device’s fast CPU but slow memory, fitting hot code into the small instruction cache, custom linker maps, symbol inspection, DTCM/ITCM placement, cache and branch alignment, cautious prefetching, and measurement. It also notes integer-division pitfalls and build-to-build performance variation.