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

Optimize QList/QString/QByteArray operations (e.g. prepend/append/insert cases)

    XMLWordPrintable

Details

    • User Story
    • Resolution: Fixed
    • P2: Important
    • None
    • 6.0
    • None

    Description

      With the introduction of prepend optimization to containers, it would be good to evaluate their actual performance and try to optimize it based on some real measurements. Initial version relies a lot on Qt5 QList's heuristics, but there are many differences between Qt5 and Qt6 QLists, so same constants do not seem to be good at a glance.

      Overall, there are 3 containers in question: QList, QString, QByteArray.
      QString/QBA are somewhat similar in terms of internal state, so likely would have similar performance concerns and solutions. QList is much more generic, I would expect differences between: pod types, (non-pod) relocatable types, complex types (non-relocatable).

      Use cases can be found in: MOC, QtCreator.
      MOC uses Qt containers a lot when generating *.moc files. Optimizing its use cases have a direct impact on the compilation speed and, due to the nature of MOC's domain, heavy workloads are expected (e.g. file parsing).
      Not sure how QtCreator is using the containers, but it probably does. And the cases should also be rather heavy and different.

      Once use cases are understood, benchmark tests can be written for profiling and continuous performance measurements (also there may exist some benchmark tests already, this is worth checking).

      How to collect use cases:

      Use cases can be "collected" in an automatic fashion: currently, operations are contained within QtPrivate::QCommonArrayOps class. The way they are used allows a simple extension of this logic: subclass QCommonArrayOps and wrap calls to its functions. Each wrapper can e.g. log certain information (size/capacity, free space at both ends, which operation is used and so on). Functions of interest: shouldGrowBeforeInsert, insert, copyAppend, erase, emplace

      Attachments

        Issue Links

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

          Activity

            People

              cnn Qt Core & Network
              agolubev Andrei Golubev
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: