Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5709

Drastically improve `to_num()` performace

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.19.0
    • None
    • C++ - Library
    • None

    Description

      Currently, the `to_string()` 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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tinloaf Lukas Barth
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h