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)
The piece examines how PostgreSQL’s TOAST storage affects performance when a table contains large JSON or XML values. In tests with 100,000 rows, a toasted table occupied 47 MB, compared with 318 MB when the values remained inline. Accessing the large field was costly because PostgreSQL had to retrieve and decode TOAST data, but queries that did not need it benefited from the smaller heap: counting rows took 26 ms rather than 92 ms, scanning to the last row took 16 rather than 53 ms, and an update took 62 rather than 128 ms. The results show that TOAST can speed ordinary heap operations even when reading the toasted column itself is expensive.
For applications that frequently query other columns but rarely need large payloads, the proposed remedy is to move the payload into a separate table and join it only when required. In the example, this reduced the main table’s heap from 47 MB to about 5 MB; a view with a LEFT JOIN lets PostgreSQL omit that join when queries do not request the payload. The tradeoff is added schema complexity, and PostgreSQL’s minimum threshold for TOAST means smaller values cannot simply be forced out of line. The discussion also compares compression methods: in a test of 100,000 large values, LZ4 compressed more than 30 times faster than pglz, while decompression was about 20% slower. Its central lesson is to treat TOAST as a useful compromise, consider separating optional bulky data, and use LZ4 when faster compression matters.
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)
Large GROUP BY hash tables cause frequent slow RAM accesses, leaving CPUs stalled even when monitoring shows 100% usage. Processing data in smaller chunks can improve cache use and speed up aggregation, even if it requires more CPU work. (pivotlake.io)
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.