Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-107788

Restore QString::toInt() performance, which deteriorated between 5.15 -> 6.0

    XMLWordPrintable

Details

    • 885ae61c63 (qt/qtbase/dev) 31e4d6403c (qt/qtbase/6.4) 31e4d6403c (qt/tqtc-qtbase/6.4) 885ae61c63 (qt/tqtc-qtbase/dev)

    Description

      QString::toInt() seems to take ~6x longer in Qt 6.x compared to Qt 5.15.

      Results below from Windows 10 21H2; customer reported similar on RHEL 8.

       

      Benchmark code

      void tst_MyClass::QString_toInt()
      {
          const QString str{"42"};
          int result;
          QBENCHMARK
          {
              result = str.toInt();
          }
          Q_UNUSED(result);
      }
      

       

      Results

      ********* Start testing of tst_MyClass *********
      Config: Using QtTest library 5.15.2, Qt 5.15.2 (x86_64-little_endian-llp64 shared (dynamic) release build; by MSVC 2019), windows 10
      PASS   : tst_MyClass::initTestCase()
      PASS   : tst_MyClass::QString_toInt()
      RESULT : tst_MyClass::QString_toInt():
           0.000072 msecs per iteration (total: 76, iterations: 1048576)
      PASS   : tst_MyClass::cleanupTestCase()
      Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 275ms
      ********* Finished testing of tst_MyClass *********
      
      ********* Start testing of tst_MyClass *********
      Config: Using QtTest library 6.0.0, Qt 6.0.0 (x86_64-little_endian-llp64 shared (dynamic) release build; by MSVC 2019), windows 10
      PASS   : tst_MyClass::initTestCase()
      PASS   : tst_MyClass::QString_toInt()
      RESULT : tst_MyClass::QString_toInt():
           0.000431 msecs per iteration (total: 113, iterations: 262144)
      PASS   : tst_MyClass::cleanupTestCase()
      Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 313ms
      ********* Finished testing of tst_MyClass *********
      
      ********* Start testing of tst_MyClass *********
      Config: Using QtTest library 6.4.0, Qt 6.4.0 (x86_64-little_endian-llp64 shared (dynamic) release build; by MSVC 2019), windows 10
      PASS   : tst_MyClass::initTestCase()
      PASS   : tst_MyClass::QString_toInt()
      RESULT : tst_MyClass::QString_toInt():
           0.000419 msecs per iteration (total: 110, iterations: 262144)
      PASS   : tst_MyClass::cleanupTestCase()
      Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 326ms
      ********* Finished testing of tst_MyClass *********
      

      Attachments

        Activity

          People

            thiago Thiago Macieira
            skoh-qt Sze Howe Koh
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: