https://bugs.llvm.org/show_bug.cgi?id=41131
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
Assignee: unassignedclangb...@nondot.org
Reporter: thomasander...@google.com
CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com
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
main() main.cc:6
The problem appears to be that snprintf_l() makes 10 calls to setlocale() via
__libcpp_locale_guard.
--------------------------------------------------------------------------------
#include <sstream>
int main() {
int x = 1234;
std::ostringstream os;
for (int i = 0; i < 100000; i++) {
os << x;
os.clear();
}
}
--------------------------------------------------------------------------------
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs