[libcxx-commits] [libcxx] [libc++] Add some _LIBCPP_ASSUMEs for bounded iterators (PR #109033)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 27 08:58:19 PDT 2025
https://github.com/ldionne commented:
When I configure my local tree with
```
-DLIBCXX_HARDENING_MODE=fast
-DLIBCXX_ABI_DEFINES="_LIBCPP_ABI_BOUNDED_ITERATORS;_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING;_LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR"
```
and then run this benchmark with and without the patch:
```
$ libcxx-lit <build> -sv --param optimization=speed --time-tests --show-all --param enable_benchmarks=run -j1 libcxx/test/benchmarks/containers/sequence/vector.bench.cpp
```
I get those results:
```
$ libcxx/utils/libcxx-compare-benchmarks build/{default,candidate} libcxx/test/benchmarks/containers/sequence/vector.bench.cpp
Comparing build/default/libcxx/test/benchmarks/containers/sequence/Output/vector.bench.cpp.dir/benchmark-result.json to build/candidate/libcxx/test/benchmarks/containers/sequence/Output/vector.bench.cpp.dir/benchmark-result.json
Benchmark Time CPU Time Old Time New CPU Old CPU New
-----------------------------------------------------------------------------------------------------------------------------------------------------
std::vector<int>::iterate-whole-container/32 -0.0273 -0.0271 11 11 11 11
std::vector<int>::iterate-whole-container/1024 -0.0257 -0.0256 336 328 336 328
std::vector<int>::iterate-whole-container/8192 -0.0375 -0.0374 2657 2558 2657 2558
std::vector<std::string>::iterate-whole-container/32 +0.3467 +0.3473 11 15 11 15
std::vector<std::string>::iterate-whole-container/1024 -0.0394 -0.0387 341 328 341 328
std::vector<std::string>::iterate-whole-container/8192 -0.0041 -0.0040 2571 2560 2570 2560
OVERALL_GEOMEAN +0.0272 +0.0276 0 0 0 0
```
I think the result for `std::vector<std::string>::iterate-whole-container/32` is a fluke due to the small size of the container. But I also don't see any improvement, which is a bit surprising to me. Any ideas?
https://github.com/llvm/llvm-project/pull/109033
More information about the libcxx-commits
mailing list