Hacker News new | ask | show | jobs
by ajross 767 days ago
tl;dr: libc++ is just bad, libstdc++ and MSVC trade punches for first place, with the eyeball win going to the FSF.

Though really the performance gates on string-heavy code tend to be in the heap and not the string library itself.

2 comments

Size is very important, and in may experience less memory usage tend to beat using less instructions. So I understand Clang decision to trade size for complexity.

Clang developers are not stupid, if they did that instead of copying what GCC or MSVC did (they both predate clang), there is a good reason, and my guess is that it is better aligned with how modern architectures and optimizers work. Anyways, that's a tradeoff, but on a modern high performance computer, intuitively, I would side with clang.

On the other hand, ABI incompatibility has a cost (not that GCC has stayed ABI-compatible with itself...)
libc++ string is smaller with a higher SSO capacity which in many scenarios can overwhelm the code generation. So it's hard to draw an absolute conclusions.
> libc++ string is smaller

modern 64bit cpus has no less than 32bytes cacheline