[Libreoffice-commits] core.git: xmlreader/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sat Apr 10 18:57:33 UTC 2021
xmlreader/source/xmlreader.cxx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 4f746b369ac6b1bdc591116a22e5df270dcf7193
Author: Noel Grandin <noel at peralex.com>
AuthorDate: Sat Apr 10 17:32:50 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Apr 10 20:56:49 2021 +0200
speed up XmlReader::handleSkippedText
this part of config loading is fairly hot at startup, so inlining this memchr
call from rtl_str_indexOfChar_WithLength shaves off 2% of my load time.
Change-Id: Ia79f43179475c51d856b685f053f597919cf12af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113924
Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/xmlreader/source/xmlreader.cxx b/xmlreader/source/xmlreader.cxx
index 85027b66ee99..5153db2fb1c3 100644
--- a/xmlreader/source/xmlreader.cxx
+++ b/xmlreader/source/xmlreader.cxx
@@ -714,12 +714,12 @@ void XmlReader::handleElementEnd() {
XmlReader::Result XmlReader::handleSkippedText(Span * data, int * nsId) {
for (;;) {
- sal_Int32 i = rtl_str_indexOfChar_WithLength(pos_, end_ - pos_, '<');
- if (i < 0) {
+ auto i = static_cast<const char*>(std::memchr(pos_, '<', end_ - pos_));
+ if (!i) {
throw css::uno::RuntimeException(
"premature end of " + fileUrl_ );
}
- pos_ += i + 1;
+ pos_ = i + 1;
switch (peek()) {
case '!':
++pos_;
More information about the Libreoffice-commits
mailing list