Bug ID: 41131
           Summary: int-to-string conversions significantly slower in
                    libc++ compared to MSVC STL
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs

On my win10 machine, the below program runs in 2.647s with libc++ and 0.357s
with MSVC's STL.  Most of the time is spent converting int to string:

snprintf_l()                          src/support/win32/locale_win32.cpp
std::num_put<>::do_put()              include/locale:1461
std::num_put<>::put()                 include/locale:1279
std::basic_ostream<>::operator<<()    include/ostream:462

The problem appears to be that snprintf_l() makes 10 calls to setlocale() via

#include <sstream>
int main() {
        int x = 1234;
        std::ostringstream os;
        for (int i = 0; i < 100000; i++) {
                os << x;

You are receiving this mail because:
You are on the CC list for the bug.
llvm-bugs mailing list

Reply via email to