aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2022-09-30 17:06:15 +0100
committerJonathan Wakely <jwakely@redhat.com>2022-09-30 21:52:02 +0100
commit1c12a3cfdfabf67c7962ee6532e001e4d48e7fc2 (patch)
treea7097f8c7d1f1181f079e1dfd43951c73d132223 /gcc/testsuite
parent4eb46f453cc74adf0055dae35cec41f4a4c4be5b (diff)
downloadgcc-1c12a3cfdfabf67c7962ee6532e001e4d48e7fc2.zip
gcc-1c12a3cfdfabf67c7962ee6532e001e4d48e7fc2.tar.gz
gcc-1c12a3cfdfabf67c7962ee6532e001e4d48e7fc2.tar.bz2
libstdc++: Optimize operator>> for std::bitset
We can improve performance by using a char buffer instead of basic_string. The loop bound already means we can't overflow the buffer, and we don't need to keep writing a null character after every character written to the buffer. We could just use basic_string::resize(N) to zero-init the whole string, then overwrite those chars. But that zero-init of all N chars would be wasted in the case where we are writing to a bitset<N> with large N, but only end up extracting one or two chars from the stream. With this change we just use buffer of uninitialized chars. For a small-ish bitset (currently <= 256) we can improve performance further by using alloca instead of the heap. libstdc++-v3/ChangeLog: * include/std/bitset (operator>>): Use a simple buffer instead of std::basic_string.
Diffstat (limited to 'gcc/testsuite')
0 files changed, 0 insertions, 0 deletions