[libcxx-commits] [PATCH] D59572: Fix and speedup __libcpp_locale_guard on Windows

Tom Anderson via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 22 20:22:42 PDT 2019


thomasanderson added a comment.

In D59572#1440417 <https://reviews.llvm.org/D59572#1440417>, @EricWF wrote:

> That said, this feels like a POSIX-ism we're leaking into our Windows implementation. So I'm open to doing whatever is more Windows-like.


Ideally we shouldn't have to use `__libcpp_locale_guard` at all.  I think its only use right now is for internally converting ints (and other numbers) to strings by setting the locale to "C", calling some variant of sprintf("%d"), and restoring the locale.  This seems like a 100 lb solution to a 1 lb problem.  setlocale() and the printf() family of functions are slow.  I think it would be much faster and not very difficult to just implement this in libc++.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59572/new/

https://reviews.llvm.org/D59572





More information about the libcxx-commits mailing list