llvm-project/libcxx/benchmarks
Mark de Wever 9393060f90 [libc++] Fixes std::to_chars for bases != 10.
While working on D70631, Microsoft's unit tests discovered an issue.
Our `std::to_chars` implementation for bases != 10 uses the range
`[first,last)` as temporary buffer. This violates the contract for
to_chars:
[charconv.to.chars]/1 http://eel.is/c++draft/charconv#to.chars-1
`to_chars_result to_chars(char* first, char* last, see below value, int base = 10);`
"If the member ec of the return value is such that the value is equal to
the value of a value-initialized errc, the conversion was successful and
the member ptr is the one-past-the-end pointer of the characters
written."

Our implementation modifies the range `[member ptr, last)`, which causes
Microsoft's test to fail. Their test verifies the buffer
`[member ptr, last)` is unchanged. (The test is only done when the
conversion is successful.)

While looking at the code I noticed the performance for bases != 10 also
is suboptimal. This is tracked in D97705.

This patch fixes the issue and adds a benchmark. This benchmark will be
used as baseline for D97705.

Reviewed By: #libc, Quuxplusone, zoecarver

Differential Revision: https://reviews.llvm.org/D100722
2021-04-29 19:56:28 +02:00
..
CMakeLists.txt [libc++] Support per-target __config_site in per-target runtime build 2021-04-28 14:27:16 -07:00
CartesianBenchmarks.h [libc++][NFC] Remove excess trailing newlines from most files 2019-10-23 08:08:57 -07:00
ContainerBenchmarks.h libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00
GenerateInput.h libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00
Utilities.h libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00
VariantBenchmarks.h [libcxx/variant] Add a few benchmarks for `std::visit`. 2020-08-11 15:48:56 -07:00
algorithms.bench.cpp Modifications to the algorithm sort benchmark 2020-07-06 18:30:02 -04:00
algorithms.partition_point.bench.cpp libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00
allocation.bench.cpp Add benchmarks to test the cost of allocator 2019-08-02 21:13:38 +00:00
deque.bench.cpp libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00
filesystem.bench.cpp libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00
function.bench.cpp libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00
lit.cfg.py Rename cxx-benchmark-unittests target and convert to LIT. 2018-11-14 20:38:46 +00:00
lit.site.cfg.py.in Rename cxx-benchmark-unittests target and convert to LIT. 2018-11-14 20:38:46 +00:00
map.bench.cpp [libc++] Add a benchmark for std::map operations 2020-09-15 12:09:29 -04:00
ordered_set.bench.cpp libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00
string.bench.cpp Add benchmarks for basic_string::erase 2020-02-19 17:09:25 -05:00
stringstream.bench.cpp
to_chars.bench.cpp [libc++] Fixes std::to_chars for bases != 10. 2021-04-29 19:56:28 +02:00
unordered_set_operations.bench.cpp [libcxx][NFC] Strip trailing whitespace, fix typo. 2019-10-23 11:49:43 -07:00
util_smartptr.bench.cpp Update more file headers across all of the LLVM projects in the monorepo 2019-01-19 10:56:40 +00:00
variant_visit_1.bench.cpp [libcxx/variant] Add a few benchmarks for `std::visit`. 2020-08-11 15:48:56 -07:00
variant_visit_2.bench.cpp [libcxx/variant] Add a few benchmarks for `std::visit`. 2020-08-11 15:48:56 -07:00
variant_visit_3.bench.cpp [libcxx/variant] Add a few benchmarks for `std::visit`. 2020-08-11 15:48:56 -07:00
vector_operations.bench.cpp libcxx: Rename .hpp files in libcxx/benchmarks to .h 2019-08-21 01:59:12 +00:00