diff options
| author | Aurélien Brooke <aurelien@bahiasoft.fr> | 2023-06-24 06:36:17 +0200 |
|---|---|---|
| committer | Aurélien Brooke <aurelien@bahiasoft.fr> | 2023-06-26 07:08:46 +0200 |
| commit | 43a5fe1a0c56c46717000c0c3ec803857bd3a9c3 (patch) | |
| tree | 4d2827646db98c096e614b20f1b4fee3c7340b0e /src/qml/jsruntime/qv4object.cpp | |
| parent | 90ddb9ef28dbd80ab3afd150415426b9dcfee894 (diff) | |
Use reserve() in ArrayObject::toQStringList()
Don't make log(N) allocations when we can just make one.
Change-Id: Icc7f743cd96d004bfa5bb77a02598e0451b0eb52
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4object.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index 6475ec6e06..19058195bc 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -1180,6 +1180,7 @@ QStringList ArrayObject::toQStringList() const ScopedValue v(scope); uint length = getLength(); + result.reserve(length); for (uint i = 0; i < length; ++i) { v = const_cast<ArrayObject *>(this)->get(i); result.append(v->toQStringNoThrow()); |
