diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2020-10-27 20:00:18 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-11-04 11:21:59 +0100 |
commit | 8f7016252a846e30efb617d2e20e929579772456 (patch) | |
tree | fb6f5506dcf180915f70a124f4631dd07a88b94c /tests/auto/corelib/tools/qlist/tst_qlist.cpp | |
parent | 4deb0d1737284e24e15ef153aa0d18daea5f731d (diff) |
Implement QList::emplaceBack as a proper function
My endeavours figuring out why QList::append(elem) gives worst
performance compared to 5.15 ended up into this commit. After some
straightforward fixes, what was left is "everything is uniformly worse"
and takes more CPU cycles
Introduce emplaceBack implementation as append is quite a special case
that could be greatly simplified. This is a "straightforward" part of
the optimizations
While at it, change append(t) to use emplaceBack(t)
For workloads like:
QList<int> list;
forever {
list.append(0);
}
this gives huge improvement (roughly 30% for 10k+ elements),
movable and complex types also get a tiny speedup
Task-number: QTBUG-87330
Change-Id: I9261084e545c24e5473234220d2a3f2cd26c2b7f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto/corelib/tools/qlist/tst_qlist.cpp')
-rw-r--r-- | tests/auto/corelib/tools/qlist/tst_qlist.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/corelib/tools/qlist/tst_qlist.cpp b/tests/auto/corelib/tools/qlist/tst_qlist.cpp index d1e321f4db..7f07b45473 100644 --- a/tests/auto/corelib/tools/qlist/tst_qlist.cpp +++ b/tests/auto/corelib/tools/qlist/tst_qlist.cpp @@ -875,7 +875,7 @@ void tst_QList::appendList() const v6 << (QList<ConstructionCounted>() << 3 << 4); QCOMPARE(v6, expectedFour); QCOMPARE(v6.at(0).copies, 2); - QCOMPARE(v6.at(0).moves, 2); + QCOMPARE(v6.at(0).moves, 1); // += QList<ConstructionCounted> v7; |