3 ms·
> A cross-platform implementation is rarely good enough, because performance often depends on platform-specific parameters and instructions. I respectfully dis
by forrestthewoods 4y ago
> A cross-platform implementation is rarely good enough, because performance often depends on platform-specific parameters and instructions.
I respectfully disagree with this.
We’re talking about std::unordered_map here. I don’t know of any platform that has done implementation work to make std::unordered_map not mediocre.
Let’s be specific. What platforms are we talking about? How many STL implementations are there? Which ones offer a significant improvement for which platforms?
C++ has been my daily driver for 15 years. I’ve shipped quite a lot of code that uses std::vector and std::unordered_map, amongst others! If I really cared about performance I’d pick a hash map implementation that wasn’t mediocre.
I would definitely not consider any std::unordered_map to be highly tuned for any platform. Quite the opposite. It’s over-specified but still stuck with different implementations. IMHO it would be much better if the C++ committee released C++XX libraries that were considered “pretty good” with support for common platforms. New or proprietary platforms can then add the relatively small bits of code necessary to support their platform (think PS5) or release a completely separate library with different constraints.
Part of the problem here is C++ also really, really sucks to compile. Maybe someday modules will make it easy to drop in new libraries and containers. Jury’s still out on that one though.
- jltsiren 4y agoI also have something like 15 years of serious C++ experience, but I've used it more for data processing than software engineering. While std::vector has almost always been good enough for me, I've often had to replace std::unordered_map with something smaller or faster, or with something where I have more control over memory layout or serialization. std::unordered_map is not a particularly good example of things that need platform-specific optimizations. The implementations I have seen are pretty close to standard C++. std::vector implementations, on the other hand, are often really weird and rely extensively on compiler-specific annotations.