diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-05 14:05:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-05 19:00:24 +0200 |
commit | b99e8c79bf630432fbb6a819d69da0bd2db7c80c (patch) | |
tree | 793e3ef8500cd466995f1c510aac5f4aeb89a36b | |
parent | 3be3a020d4c243f9b12d90fe75be103337002be6 (diff) |
don't re-allocate ScriptRun vector unnecessarily
resize() will re-allocate the array which seems unnecessary here.
(This change eliminates reset() from my perf profile)
Change-Id: I61d02ddc88ed186308d90e2c7bf8d7237194f0b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118435
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | vcl/inc/scrptrun.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/vcl/inc/scrptrun.h b/vcl/inc/scrptrun.h index db2a778cf24a..0d64109b6fe9 100644 --- a/vcl/inc/scrptrun.h +++ b/vcl/inc/scrptrun.h @@ -111,7 +111,11 @@ private: static const char fgClassID; }; -inline ScriptRun::ScriptRun(const UChar chars[], int32_t length) { reset(chars, 0, length); } +inline ScriptRun::ScriptRun(const UChar chars[], int32_t length) +{ + parenStack.reserve(128); + reset(chars, 0, length); +} inline int32_t ScriptRun::getScriptStart() const { return scriptStart; } @@ -125,7 +129,7 @@ inline void ScriptRun::reset() scriptEnd = charStart; scriptCode = USCRIPT_INVALID_CODE; parenSP = -1; - parenStack.resize(128); + parenStack.clear(); } inline void ScriptRun::reset(int32_t start, int32_t length) |