[libcxx-commits] [PATCH] D147741: [libc++, std::vector] call the optimized version of __uninitialized_allocator_copy for trivial types
Aditya Kumar via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue May 16 23:35:23 PDT 2023
hiraditya added inline comments.
================
Comment at: libcxx/benchmarks/ContainerBenchmarks.h:42
+ auto size = st.range(0);
+ Container c1(size);
+ Container c2(size);
----------------
var-const wrote:
> hiraditya wrote:
> > var-const wrote:
> > > Is it deliberate that `c1` and `c2` are the same size (even though `c1` gets overwritten)? If yes, please add a comment.
> > Yeah, there was no reason to have `c2` as the same size. Updated the test.
> Hmm, I expected that `c1` will be empty, not `c2` (since `c2` is the one that provides the final value). Or does the optimization only apply if the existing capacity can be reused? If so, then I think the previous state with both `c1` and `c2` being large was better.
oops, good catch!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147741/new/
https://reviews.llvm.org/D147741
More information about the libcxx-commits
mailing list