[Libreoffice-commits] core.git: vcl/inc

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 5 17:00:59 UTC 2021


 vcl/inc/scrptrun.h |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit b99e8c79bf630432fbb6a819d69da0bd2db7c80c
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 5 14:05:42 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 5 19:00:24 2021 +0200

    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 at collabora.co.uk>

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)


More information about the Libreoffice-commits mailing list