Skip to content

hdcos/z1brc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

z1brc

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

How to run

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

Current implementation

  • 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

Next & ideas

  • 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

About

My journey through the 1brc challenge

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages