Show HN: NES Contra (1987) port (ASM –> C and then C –> WebAssembly)
A browser-based port of the 1987 NES game Contra converts its assembly code to C and then WebAssembly. It supports solo play and online two-player games. (epoyraz.github.io)
A database query can report 100% CPU use while the processor spends much of its time stalled, waiting for data from RAM. The key bottleneck in a GROUP BY with millions of distinct values is often memory latency: a large hash table makes lookups likely to miss the CPU’s small, fast caches and fetch data from much slower DRAM. The argument is that doing more CPU work can still make a query faster if it reduces those costly memory accesses.
To test this, the author compares a straightforward aggregation against a partitioned approach on ClickBench’s 99-million-row hits dataset, with about 17 million unique UserIDs. The partitioned version hashes each key into one of 4,096 vectors, then aggregates each partition in a smaller hash table. On a single core of an AMD EPYC 9124, this extra work reduced memory-stall time from roughly 50% to 23.5% and DRAM reads from 4.5 GB to 1.5 GB; runtime fell to about 2.7-3.3 seconds, depending on the run. Pivot’s more optimized single-core implementation took about 1.85 seconds and read 954 MB, while its 16-core execution took about 172 milliseconds. The broader lesson is to optimize for data locality and cache behavior, not simply to minimize instructions.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.
A browser-based port of the 1987 NES game Contra converts its assembly code to C and then WebAssembly. It supports solo play and online two-player games. (epoyraz.github.io)
PostgreSQL’s TOAST storage made the table much smaller, and counting or scanning rows was faster than with the larger uncompressed table. But reading a field inside every toasted value required far more buffer reads, showing that TOAST can trade space savings for slower access to large values. (pgedge.com)
Enlightenment 0.28 adds initial NetBSD support, a NetworkManager module, and native PipeWire mixer support while retaining PulseAudio compatibility. The release also improves window management, display handling, and X11 and Wayland support, alongside numerous fixes and code cleanups. (phoronix.com)
Nonna is a TypeScript dependency-injection framework and ahead-of-time compiler that avoids reflection and runtime dependencies. It supports Node.js, Deno, Bun, edge runtimes, and major frontend frameworks, with request scoping and deterministic lifecycle hooks. (nonna.nodeboot.io)
Jepsen found 96 bugs in ParticleDB versions 1.1.4 through 1.1.18.11.rc-22, including crashes, data loss, and serious transaction anomalies. Most issues were fixed, but committed writes could still disappear and serializable transactions still had anomalies; Orkes says a later release resolves the remaining problems. (jepsen.io)
GCC can lower dense switch statements into jump tables, subtracting a constant when case values share an offset. It generally favors jump tables when the value range has no more than about eight entries per case label. (xoranth.net)
Today's best Hacker News stories, summarized and screenshotted, one email a day.