Merge pull request #2596 from olowo726/master

getText performance improvement by making UTF32Converter thread_local instead of local.
This commit is contained in:
Terence Parr 2019-07-12 10:37:57 -07:00 committed by GitHub
commit bda96a0081
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -217,4 +217,5 @@ YYYY/MM/DD, github id, Full name, email
2019/02/06, ralucado, Cristina Raluca Vijulie, ralucris.v[at]gmail[dot]com 2019/02/06, ralucado, Cristina Raluca Vijulie, ralucris.v[at]gmail[dot]com
2019/03/13, base698, Justin Thomas, justin.thomas1@gmail.com 2019/03/13, base698, Justin Thomas, justin.thomas1@gmail.com
2019/03/18, carlodri, Carlo Dri, carlo.dri@gmail.com 2019/03/18, carlodri, Carlo Dri, carlo.dri@gmail.com
2019/05/02, askingalot, Andy Collins, askingalot@gmail.com 2019/05/02, askingalot, Andy Collins, askingalot@gmail.com
2019/07/11, olowo726, Olof Wolgast, olof@baah.se

View File

@ -22,7 +22,7 @@ namespace antlrcpp {
inline std::string utf32_to_utf8(T const& data) inline std::string utf32_to_utf8(T const& data)
{ {
// Don't make the converter static or we have to serialize access to it. // Don't make the converter static or we have to serialize access to it.
UTF32Converter converter; thread_local UTF32Converter converter;
#if defined(_MSC_VER) && _MSC_VER >= 1900 && _MSC_VER < 2000 #if defined(_MSC_VER) && _MSC_VER >= 1900 && _MSC_VER < 2000
auto p = reinterpret_cast<const int32_t *>(data.data()); auto p = reinterpret_cast<const int32_t *>(data.data());
@ -34,7 +34,7 @@ namespace antlrcpp {
inline UTF32String utf8_to_utf32(const char* first, const char* last) inline UTF32String utf8_to_utf32(const char* first, const char* last)
{ {
UTF32Converter converter; thread_local UTF32Converter converter;
#if defined(_MSC_VER) && _MSC_VER >= 1900 && _MSC_VER < 2000 #if defined(_MSC_VER) && _MSC_VER >= 1900 && _MSC_VER < 2000
auto r = converter.from_bytes(first, last); auto r = converter.from_bytes(first, last);