• AlmightySnoo 🐢🇮🇱🇺🇦
    link
    41 year ago

    The lost performance comes from the fact that vector::push_back has to check whether it needs to grow the vector, even though it will never happen in the convert_to_indices function. A sufficiently smart compiler could optimize this out, but neither GCC nor Clang do (and MSVC makes a complete hash of things).

    Ok that one is new to me, I didn’t know that despite the .reserve the compilers are still unable to figure that out.