diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-10-28 21:35:33 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-11-04 11:21:22 +0100 |
commit | b99271caa6231ad753bc796dae5202ebc1cb9440 (patch) | |
tree | ed1d59d157ff92a774060f023547b0e654cfbebc /src/corelib/text/qstring.h | |
parent | e5f80c1b0310412993e781691f39aa2b25e404fb (diff) |
Avoid expensive iterator calculations in append()
Avoid moving data inside the array to create free
space at one end. This is a performance bottleneck,
as it required quite a lot of calculations for every
insert. Rather reallocate and grow in this case,
so we only need to do expensive work when we reallocate
the array.
Change-Id: Ifc955fbcf9967c3b66aa2600e0627aac15f0c917
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src/corelib/text/qstring.h')
-rw-r--r-- | src/corelib/text/qstring.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index 46c2fd3f66..66a99d4e43 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -1059,7 +1059,7 @@ private: static const char16_t _empty; void reallocData(qsizetype alloc, Data::ArrayOptions options); - void reallocGrowData(qsizetype alloc, Data::ArrayOptions options); + void reallocGrowData(qsizetype n); static int compare_helper(const QChar *data1, qsizetype length1, const QChar *data2, qsizetype length2, Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept; |