diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2020-10-29 12:11:49 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-11-04 11:21:06 +0100 |
commit | 12718e5ea289df1d3f113bf0ff4e64ea8961e20d (patch) | |
tree | 9b4424e23e05bd8428f37cedeec3aafa15814a2e /src/corelib/text/qstring.cpp | |
parent | 02a5928fa5a9bd348af90ba8ed9f7ef675bcb8b7 (diff) |
Add QList::emplaceFront() that fixes huge performance issue in prepend
Prepend in QList was using insert() logic that always uses append-aware
functions. This results in the fact that freeSpaceAtBegin() is always 0
and forces us to actually allocate on *every* call (with the same
capacity!). Vicious cycle is hot-fixable with introduction of
emplaceFront (or anything prepend-aware, really)
This brings me from 632ms to 0.65ms for 100k iterations of
list.prepend(int(0)). Still ~3x worse than QList in 5.15 but much
faster than QVector, which takes 382ms in the same workload
Not addressed:
- QString/QBA
- Other prepend functions in QList e.g. prepend(it1, it2)
- Lower-level array operations that should just be extended
Task-number: QTBUG-86583
Change-Id: Ie82b07d81a67605cd308d9fabf9532d57935647f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qstring.cpp')
0 files changed, 0 insertions, 0 deletions