[libcxx-commits] [PATCH] D102727: Use precise growth rather than amortized growth in std::string::resize/__resize_default_init.
Martijn Vels via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jul 15 16:44:42 PDT 2021
mvels added a comment.
Some 2 cents from my side.
The change here LGTM, but I do think the O(SQR) use case is a sharp edge. I think we should shield the 'stable' folks from these sharp edges imho. The libc++ spec states nothing about the 'growth' of resize(), which would make me caution on the side of `DTRT` instead of `does the minimum memory thing`. The latter is more a faang thing. I would imagine that a 'stable' user might be surprised with sudden regressions without maybe being too concerned with (temporary) allocations being +/- 20%.
My suggestion would be to **make this the default for UNSTABLE only**. Which means we don't create new knobs and defines, but simply #ifdef the few new loc under unstable.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102727/new/
https://reviews.llvm.org/D102727
More information about the libcxx-commits
mailing list