z1brc
is my personal journey while taking the 1brc challenge in node.js.
Currently on a Mac M1 8cores 16GB
I get those results at first run (rounded):
- 5 secs for 1.38G
- 55 secs for 13.8G
Be sure to generate the sample and change the constant variable in supervisor.js
to point to the file you want to extract results from.
$ node --version
v18.18.2 (or later)
then
/usr/bin/time -p node supervisor.mjs
- 1 worker per core
- read sync put each chunk into queue
- workers pool reading queue
- transfer list with 0 copy from main to worker
- decoder in worker
- single pass parsing in each worker
- aggregate results from each worker
- print results
- file in parameter
- parsing in binary
- no decoding before parsing, do a decode after parsing while printing ?
- find a way to transfer the results without copying from worker to reach full 0 copy