diff options
author | Noel Grandin <noel@peralex.com> | 2021-04-10 17:32:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-10 20:56:49 +0200 |
commit | 4f746b369ac6b1bdc591116a22e5df270dcf7193 (patch) | |
tree | 47e992c247bef32f55dddee33273fa0c728d9ae2 /xmlreader | |
parent | f3151e62bcc7cb66313df70a2ec8eed8ca8f2c88 (diff) |
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@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlreader')
-rw-r--r-- | xmlreader/source/xmlreader.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
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_; |