News for hackers. Stuff that matters.
Re:The Billion Row Challenge (1BRC) – Step-by-Step from 71s ... by jasonjmcghee on Thursday February 22, 2024 @03:25PM (#39472677)
I thought everyone used hashbrown now

https://github.com/rust-lang/hashbrown

Re:The Billion Row Challenge (1BRC) – Step-by-Step from 71s ... by IshKebab on Thursday February 22, 2024 @04:17PM (#39473384)
They do because the standard library implementation was changed to use Hashbrown. However the standard library API has a slight limitation in that you can't get say "I have a reference to a string. If there's an entry for it, give me that. Otherwise clone the string and insert a new entry. Also only do one key lookup."

You end up either having to do two lookups or always cloning the string even if you ended up not needing it.

Re:The Billion Row Challenge (1BRC) – Step-by-Step from 71s ... by GrumpySloth on Friday February 23, 2024 @07:06AM (#39479571)
Re:The Billion Row Challenge (1BRC) – Step-by-Step from 71s ... by IshKebab on Friday February 23, 2024 @08:39AM (#39480427)
You can't. `entry()` takes they key by value, not by reference:

https://doc.rust-lang.org/std/collections/hash_map/struct.Ha...

You might be getting confused because in that example the `HashMap` keys are references.

Re:The Billion Row Challenge (1BRC) – Step-by-Step from 71s ... by GrumpySloth on Friday February 23, 2024 @09:01AM (#39480645)
My bad. That’s not been an issue in my code, as I use arenas to manage memory and never put an owning container as key in a HashMap.