4 ms·
It's wild to me that they would write performance focused code (unsafe ptrs, memory mapped files, etc) and then still use linq in the main work loop [0]. This i
by eyegor 3y ago
It's wild to me that they would write performance focused code (unsafe ptrs, memory mapped files, etc) and then still use linq in the main work loop [0]. This implementation could go much much faster. Of course rewriting the parallelism and aggregation from linq is a decent amount of effort, but I'm betting that applying the lazy man's hack [1] would have decent gains.
[0] https://github.com/buybackoff/1brc/blob/main/1brc/App.cs#L126 https://github.com/buybackoff/1brc/blob/main/1brc/App.cs#L12...
[1] https://github.com/reegeek/StructLinq https://github.com/reegeek/StructLinq
- anonymoushn 3y agoI don't think much time is spent in this code.
- buybackoff 3y agoAuthor there. Nothing really matters other than `ProcessChunk`. Don't you think I kind of know what I'm doing with these numbers!?
- brabel 3y agoYou're assuming they didn't try that. I wrote a blog post about a benchmark once, and posted on Reddit/HN, and everyone was like "clearly he should've tried X and Y" which I had, but didn't mention because I had mentioned many other things already which I thought were more interesting to mention... So, my advice is: try it before you accuse someone of not having done it properly. I can almost guarantee you'll find it's not better. If you find it's better, then at least you don't make a fool of yourself by suggesting inocuous changes. Performance is very surprising sometimes.
- deleted 3y ago[deleted]