buybackoff / 1brc

1BRC in .NET among fastest on Linux
https://hotforknowledge.com/2024/01/13/1brc-in-dotnet-among-fastest-on-linux-my-optimization-journey/
MIT License
437 stars 43 forks source link

Last benchmark for kpocza's repo #18

Closed kpocza closed 7 months ago

kpocza commented 7 months ago

I've made some improvements to my implementation (https://github.com/kpocza/1brc) mostly by decreasing hash collisions, exploiting cache locality. I expect it to run 10-20% faster (especially for the 10k tests), but far slower than the best competitors. Please rerun you benchmarks.

buybackoff commented 7 months ago

Something is not working.

Please make sure that this setup works: https://github.com/buybackoff/1brc-bench

A command ./run.sh kpocza 4 4 1B should work. Now if I run the binary manually it just returns {Munūf=16.3/16.3/16.3, asKr=23.8/23.8/23.8, kwaw=8.2/8.2/8.2, peta=10.2/10.2/10.2} in 5 msecs.

kpocza commented 7 months ago

FileInfo's Length property returns the length of the symlink, not the target. Fixed it.

So I've cloned your benchmarking repo. When I run the update.sh it shows that HEAD is 'Vector calculation, ...' which is not fine, as it should update to commit 'Fix symlink file length bug'. According to git log everything seems fine. As I see "git reset --hard" on the submodule is doing something wrong. If I specify origin/main as argument, then it's fine. I see similar situation for austindonisan's repo, as well. (I'm not a git master, by the way.) I use git 2.25.1 on Ubuntu 20.04 under WSL 2.

buybackoff commented 7 months ago

I think I need to update my repo. I removed the code that did update every submodule to the latest commit, because it was more problematic than helpful. Exactly the cause was austindonisan changing branches, I lost so much time with the previous update.sh logic for his repo so I decided just to freeze commits at my parent level. That also makes it even more reproducible, nothing random from upstream could jump in.

I will see how it works. I've updated the bench repo.

buybackoff commented 7 months ago

It works but the result is slower for the default on my small Intel dev machine. I see a big gain on 10K dataset: 4.2 sec vs 5.6 sec before. (all AOT).

Anyways, it will be in the bench pipeline. Many more rounds to tests.

kpocza commented 7 months ago

Thank you for checking. Maybe it's slower due to cache locality of buckets as I have optimized for 10k dataset hash collisions. If I have time I will check it. Anyway, the original 1brc for Java ends by Jan 31. Do you plan to finish the competition on the same date or some time later?

buybackoff commented 7 months ago

I will freeze all submodules that are in this repo at the official cut off time UTC midnight.

I will include top 5 existing solutions from each category (.NET, Java and Native) and will run benches overnight after that and multiple machines. I will not include any new solution appearing today, even if it the fastest. That would be predatory behavior taking all the knowledge and not giving it back. I would not care updating my infra for that.

And no more of this stuff. It's been already a huge time waste, even if a fun one.

kpocza commented 7 months ago

I really appreciate the huge effort you made to run 1brc for .NET.

Meanwhile I've optimized the comparison logic of short cities. On my machine it's faster.

Please include my today's commit in you benchmark.

buybackoff commented 7 months ago

Done.