[libcxx-commits] [libcxx] [libc++] Optimize num_get integral functions (PR #121795)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 26 07:58:01 PST 2025
================
@@ -836,98 +796,137 @@ _InputIterator num_get<_CharT, _InputIterator>::__do_get_signed(
char_type __atoms1[__atoms_size];
const char_type* __atoms = this->__do_widen(__iob, __atoms1);
string __grouping = this->__stage2_int_prep(__iob, __thousands_sep);
- string __buf;
- __buf.resize(__buf.capacity());
- char* __a = &__buf[0];
- char* __a_end = __a;
unsigned __g[__num_get_base::__num_get_buf_sz];
unsigned* __g_end = __g;
unsigned __dc = 0;
- for (; __b != __e; ++__b) {
- if (__a_end == __a + __buf.size()) {
- size_t __tmp = __buf.size();
- __buf.resize(2 * __buf.size());
- __buf.resize(__buf.capacity());
- __a = &__buf[0];
- __a_end = __a + __tmp;
+
----------------
ldionne wrote:
In the new code, we don't seem to have a clear notion of "stage3". If that's the case, you should also change the comment about `Stage 2` above. Please explain what your algorithm does, how it combines `Stage 2` and `Stage 3` together, how and why it differs from what's written in the Standard.
https://github.com/llvm/llvm-project/pull/121795
More information about the libcxx-commits
mailing list