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

Add a QByteArrayRef class

    XMLWordPrintable

Details

    • 631127126cc14e7c01cc611532b3256b58785670

    Description

      A class similar to QStringRef (QByteArrayRef?) would be very useful for processing binary messages containing binary or encoded text data.

      The attached microbenchmark project compares QString/QStringRef creation performance using QString::mid(), QString::fromRawData() and QString::midRef(). This benchmark more or less shows how much of a performance gain can be expected in similar tight message parsing loops.

      Output of an example run:

      Config: Using QTest library 4.8.4, Qt 4.8.4
      PASS   : QStringRef_Test::initTestCase()
      RESULT : QStringRef_Test::benchmarkQString():
           1.0 msecs per iteration (total: 70, iterations: 64)
      PASS   : QStringRef_Test::benchmarkQString()
      RESULT : QStringRef_Test::benchmarkFromRawData():
           0.77 msecs per iteration (total: 99, iterations: 128)
      PASS   : QStringRef_Test::benchmarkFromRawData()
      RESULT : QStringRef_Test::benchmarkQStringRef():
           0.68 msecs per iteration (total: 88, iterations: 128)
      PASS   : QStringRef_Test::benchmarkQStringRef()
      PASS   : QStringRef_Test::cleanupTestCase()
      Totals: 5 passed, 0 failed, 0 skipped
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sonakur Sona Kurazyan
            ckakman Kayra Akman
            Votes:
            4 Vote for this issue
            Watchers:
            13 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes