Skip to content

Commit

Permalink
fixed performance degradation (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Aug 29, 2016
1 parent 87dea32 commit 29c5f32
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ fuzz: test/src/fuzz.cpp src/json.hpp
cppcheck:
cppcheck --enable=warning --inconclusive --force --std=c++11 src/json.hpp --error-exitcode=1

clang_sanitize: clean
CXX=clang++ CXXFLAGS="-g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer" $(MAKE)

##########################################################################
# maintainer targets
##########################################################################
Expand Down
3 changes: 2 additions & 1 deletion src/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2232,7 +2232,8 @@ class basic_json
{
std::stringstream ss;
// fix locale problems
ss.imbue(std::locale(std::locale(), new DecimalSeparator));
const static std::locale loc(std::locale(), new DecimalSeparator);
ss.imbue(loc);

// 6, 15 or 16 digits of precision allows round-trip IEEE 754
// string->float->string, string->double->string or string->long
Expand Down
3 changes: 2 additions & 1 deletion src/json.hpp.re2c
Original file line number Diff line number Diff line change
Expand Up @@ -2232,7 +2232,8 @@ class basic_json
{
std::stringstream ss;
// fix locale problems
ss.imbue(std::locale(std::locale(), new DecimalSeparator));
const static std::locale loc(std::locale(), new DecimalSeparator);
ss.imbue(loc);

// 6, 15 or 16 digits of precision allows round-trip IEEE 754
// string->float->string, string->double->string or string->long
Expand Down

0 comments on commit 29c5f32

Please sign in to comment.