aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits/regex.h
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2024-03-07 13:47:46 +0000
committerJonathan Wakely <jwakely@redhat.com>2024-03-07 23:50:39 +0000
commit715127b63d19ed3b9a92d3e5f5007b36cc9834dd (patch)
treeb75e61d18c2315074e1a09181258557102c267f1 /libstdc++-v3/include/bits/regex.h
parent5f9d7a5b6cf64639274e63051caf70fbc8418ea2 (diff)
downloadgcc-715127b63d19ed3b9a92d3e5f5007b36cc9834dd.zip
gcc-715127b63d19ed3b9a92d3e5f5007b36cc9834dd.tar.gz
gcc-715127b63d19ed3b9a92d3e5f5007b36cc9834dd.tar.bz2
libstdc++: Use std::from_chars to speed up parsing subsecond durations
With std::from_chars we can parse subsecond durations much faster than with std::num_get, as shown in the microbenchmarks below. We were using std::num_get and std::numpunct in order to parse a number with the locale's decimal point character. But we copy the chars from the input stream into a new buffer anyway, so we can replace the locale's decimal point with '.' in that buffer, and then we can use std::from_chars on it. Benchmark Time CPU Iterations ---------------------------------------------------------- from_chars_millisec 158 ns 158 ns 4524046 num_get_millisec 192 ns 192 ns 3644626 from_chars_microsec 164 ns 163 ns 4330627 num_get_microsec 205 ns 205 ns 3413452 from_chars_nanosec 173 ns 173 ns 4072653 num_get_nanosec 227 ns 227 ns 3105161 libstdc++-v3/ChangeLog: * include/bits/chrono_io.h (_Parser::operator()): Use std::from_chars to parse fractional seconds.
Diffstat (limited to 'libstdc++-v3/include/bits/regex.h')
0 files changed, 0 insertions, 0 deletions