1,113 karma · joined July 29, 2016
Husband and Father. More @ https://rockwotj.com
Source: I contribute a lot to wasmtime’s C API and build Redpanda’s Wasm Data Transforms using it
https://github.com/floooh/sokol-tools/blob/master/build.zig
Here is a tutorial: https://www.zvm.app/tutorials/zig-build-cpp.html
As for I/O concerns, run it in CI with deno and ensure there is no I/O
Took me a couple of hours, mostly because of some pthread stuff I had to noop. And that's being fixed with wasi-threads
I have arrived that I think using typescript to generate JSON as being the ultimate solution.
Easy JSON support, optional typing, you already know it, and adding reusable functions and libraries is understandable. Just prevent external node modules, and have a tool that takes a typescript file with a default export of some JSON and renders the JSON to a string on stdout.
Disk access can certainly be parallelized, and NVMe is blazing fast, so the bottleneck is more the CPU than disk. There are systems that are built around around modern hardware that realize this (redpanda.com, where I work is one such example)
Parsing is a lot of the compute time and some SIMD tricks like SWAR for finding delimiters can be helpful. Stringzilla is a cool library if you want to see a clean implementation of these algorithms: https://github.com/ashvardanian/StringZilla
See my reply here about the file being cached completely in memory after the first run: https://news.ycombinator.com/item?id=38864034
The author does explicitly want all the files to be cached in memory for the later runs: https://x.com/gunnarmorling/status/1742181941409882151?s=20
Code: https://github.com/rockwotj/1brc
Discussion on Filesystem cache: https://x.com/rockwotj/status/1742168024776430041?s=20
I don’t believe this in a second. Even if an AI could cobble code together to make an entire social media platform, there is a lot that goes into building something like this. Even if you could make a Twitter clone in an hour with Firebase, you have to figure out how to get people to use your platform, which usually seems to happen because of network effects.