diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2019-10-17 20:33:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-26 12:38:33 +0200 |
commit | e276c812648bf511d6c4813d6fd82a00391cfdac (patch) | |
tree | adbf24f41bef128a081cc1cc117c8023a3eed65d /dbaccess | |
parent | d04f044f05b4d13c3c6ea3f33fddd9c05a0ab3ad (diff) |
size some stringbuffer to prevent re-alloc
I started with 32 and kept doubling the size until the site
did not need re-alloc, but clamped it at 512 (e.g. in emfio/).
Change-Id: Ib7caf35a1b7e42b0e4ed8aa812493449e3eefc8f
Reviewed-on: https://gerrit.libreoffice.org/81540
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/filter/hsqldb/createparser.cxx | 7 | ||||
-rw-r--r-- | dbaccess/source/filter/hsqldb/fbcreateparser.cxx | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/dbaccess/source/filter/hsqldb/createparser.cxx b/dbaccess/source/filter/hsqldb/createparser.cxx index 56f3f7fdb721..ad1c95f89966 100644 --- a/dbaccess/source/filter/hsqldb/createparser.cxx +++ b/dbaccess/source/filter/hsqldb/createparser.cxx @@ -52,14 +52,17 @@ std::vector<OUString> lcl_splitColumnPart(const OUString& sColumnPart) std::vector<OUString> sParts = string::split(sColumnPart, sal_Unicode(u',')); std::vector<OUString> sReturn; - OUStringBuffer current; + OUStringBuffer current(128); for (auto const& part : sParts) { current.append(part); if (current.lastIndexOf("(") > current.lastIndexOf(")")) current.append(","); // it was false split else - sReturn.push_back(current.makeStringAndClear()); + { + sReturn.push_back(current.toString()); + current.setLength(0); + } } return sReturn; } diff --git a/dbaccess/source/filter/hsqldb/fbcreateparser.cxx b/dbaccess/source/filter/hsqldb/fbcreateparser.cxx index 756b2bd3d445..70b7810dc7c2 100644 --- a/dbaccess/source/filter/hsqldb/fbcreateparser.cxx +++ b/dbaccess/source/filter/hsqldb/fbcreateparser.cxx @@ -136,7 +136,8 @@ void FbCreateStmtParser::ensureProperTableLengths() const OUString FbCreateStmtParser::compose() const { ensureProperTableLengths(); - OUStringBuffer sSql("CREATE TABLE "); + OUStringBuffer sSql(128); + sSql.append("CREATE TABLE "); sSql.append(getTableName()); lcl_appendWithSpace(sSql, "("); // column declaration |