News for hackers. Stuff that matters.
Re:Effortless Performance Improvements in C++: std:unordered... by benreesman on Thursday March 02, 2023 @03:31AM (#34993411)
Clearly a veteran of C++ in particular or the “zero-cost abstraction” cluster of languages in general is not going to miss a bunch of needless allocations etc. in a setting where performance matters a lot and I basically agree about the high notes of where you’d start to tune this up.

But the author is clearly a highly-motivated intermediate C++ user who is taking time to share some key lessons and anyone who keeps that up for long won’t be intermediate for long!

So it’s still a cool blog IMHO :)

Re:Effortless Performance Improvements in C++: std:unordered... by raverbashing on Thursday March 02, 2023 @03:42AM (#34993478)
Well I'm always surprised how the actual implementation of the stl primitives looks like "C++ cool tricks 101" turned to eleven and I wouldn't be surprised if the ability of compilers to optimize that was not great
Re:Effortless Performance Improvements in C++: std:unordered... by benreesman on Thursday March 02, 2023 @03:52AM (#34993542)
Eh, the folks writing the standard library definitely work adjacent to the folks doing the compiler in C++ for sure and I think Rust and stuff too. Both gcc and clang for example ship with co-designed standard libraries.

It’s backwards compatibility that kills them on performance which is why the 900-IQ C++ shops like Google etc. just go their own way on the hash table because it’s worth it to them to do the extra work.

Re:Effortless Performance Improvements in C++: std:unordered... by leeter on Thursday March 02, 2023 @10:08AM (#34996557)
It's not just backwards compat, it's all the crazy guarantees that the stdlib has to make. Most code doesn't have strong exception guarantees... the stdlib generally speaking does. It also has to deal with all sorts of silly things without breaking like people overloading operator,() and still expecting things to work without issue. They really are a case study in getting decent performance in most cases out of exceptionally defensively written code.