1brc / 1brc.github.io

🌐 1brc.dev website for @1brc
https://1brc.dev
MIT License
8 stars 5 forks source link

1BRC in Awk! #1

Open glentner opened 4 months ago

glentner commented 4 months ago

Clever implementations and aggressive parallelism have achieved incredible times, but I was curious what the naive, almost 1-liner in Awk would look like.

https://github.com/glentner/1brc-awk

I have found Awk to be wonderfully performant in a lot of these sorts of daily accumulation tasks, but in this case it's own internal associative array isn't too much faster than the naive implementation in something like Python. The equivalent, basic approach in something like Rust/C++ (no multi-threading, just HashMap/std::map and a struct) are 30% faster.

The redeeming quality here is the implementation took literally a minute with no compile step.

jcbhmr commented 4 months ago

Awesome! 🤩 In only 12 lines too! Are you accepting submissions from others that I can add a link to the website and the GitHub org readme to your repository? Do you want to add it to the @1brc org? This org is so far unofficial -- if you want to show this off to more people I highly recommend you share it on the current official discussion board too!

glentner commented 4 months ago

I'm happy for folks to submit additional Awk implementations to my repo if that's what you mean.