[llvm-bugs] [Bug 41131] New: int-to-string conversions significantly slower in libc++ compared to MSVC STL
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Mar 18 16:25:33 PDT 2019
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: unassignedclangbugs at nondot.org
Reporter: thomasanderson at google.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190318/cfc35d11/attachment.html>
More information about the llvm-bugs
mailing list