You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Lukas Barth (Jira)" <ji...@apache.org> on 2023/05/12 13:02:00 UTC

[jira] [Created] (THRIFT-5709) Drastically improve `to_num()` performace

Lukas Barth created THRIFT-5709:
-----------------------------------

             Summary: Drastically improve `to_num()` performace
                 Key: THRIFT-5709
                 URL: https://issues.apache.org/jira/browse/THRIFT-5709
             Project: Thrift
          Issue Type: Improvement
          Components: C++ - Library
    Affects Versions: 0.19.0
            Reporter: Lukas Barth


Currently, the `to_num()` overloads in `TToString.h` call the `std::locale` constructor for *every* single call. Creating locales is surprisingly expensive. We have an application where we - especially during tests - write large amounts of Thrift dumps to disk, and is this application we currently spend around 17% of total CPU time in std::locale's constructor (building with MSVC, in a Release build - other compilers might optimize this away?). With the proposed change (see GitHub), it's basically down to zero.

Since we always create the exact same locale anyways, using a `const static` one does not hurt.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)