Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
6.6.0
-
None
-
b347d4870 (dev), f5021835d (dev), dfe968e97 (dev), 5ea4e2766 (dev)
Description
To some surprise by chance it was seen that for a given QByteArray instance the code is faster when it does not directly call indexOf(char) on it, but instead calls the indexOf(char) only on a QByteArrayView on that QByteArray instance.
Looking at the Qt code the cause seems to be that that QByteArrayView::indexOf(char) is an inlined method, so can be optimized by the compiler. While QByteArray::indexOf(char) is not, and internally actually also just forwards the the very QByteArrayView method, so is more expensive due to the need to always invoke the method symbol.
Perhaps could be solved by making QByteArray::indexOf(char) also inline, using the QT_CORE_INLINE_SINCE approach introduced elsewhere, I guess?
Attachments
For Gerrit Dashboard: QTBUG-119750 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
523351,6 | QByteArray: inline QByteArray::indexOf() and use a char overload | dev | qt/qtbase | Status: MERGED | +2 | 0 |
523352,5 | QString: inline indexOf() and use a QChar overload | dev | qt/qtbase | Status: MERGED | +2 | 0 |
523353,5 | QString/QByteArray: further inline the most common indexOf operations | dev | qt/qtbase | Status: MERGED | +2 | 0 |
523482,7 | qTo*ViewIgnoringNull: further ignore nulls | dev | qt/qtbase | Status: MERGED | +2 | 0 |