diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2019-10-09 20:30:42 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2019-10-10 07:55:00 +0200 |
commit | 25a3658f514e644ca89294530f1cd5398795dcfb (patch) | |
tree | ca63646a4850b5431401d9f6fbc3056cb95c92e5 /xmlreader | |
parent | d55320b95b40770986a7bce9ab96fbd570dd8cb7 (diff) |
Revert "Optimize getNamespaceId (xmlreader)"
This reverts commit def00961243da0662f394bdf58b1157cfd45dfab.
Finally after other tests, it doesn't improve perfs
Change-Id: Icbaaf751181069dd36dba0c676a4c9a2a6c8a9f3
Reviewed-on: https://gerrit.libreoffice.org/80565
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'xmlreader')
-rw-r--r-- | xmlreader/source/span.cxx | 4 | ||||
-rw-r--r-- | xmlreader/source/xmlreader.cxx | 11 |
2 files changed, 0 insertions, 15 deletions
diff --git a/xmlreader/source/span.cxx b/xmlreader/source/span.cxx index 300c0a2e99b3..29433c561fb7 100644 --- a/xmlreader/source/span.cxx +++ b/xmlreader/source/span.cxx @@ -46,10 +46,6 @@ OUString Span::convertFromUtf8() const { return OUString(s, SAL_NO_ACQUIRE); } -std::size_t Span::hashCode() const { - return rtl_str_hashCode_WithLength(begin, length); -} - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlreader/source/xmlreader.cxx b/xmlreader/source/xmlreader.cxx index 918f42a2e1b2..85027b66ee99 100644 --- a/xmlreader/source/xmlreader.cxx +++ b/xmlreader/source/xmlreader.cxx @@ -182,19 +182,11 @@ Span XmlReader::getAttributeValue(bool fullyNormalize) { } int XmlReader::getNamespaceId(Span const & prefix) const { - if (auto it = cacheNSIds_.find(prefix); it != cacheNSIds_.end()) - { - return it->second; - } - auto i = std::find_if(namespaces_.crbegin(), namespaces_.crend(), [&prefix](const NamespaceData& rNamespaceData) { return prefix == rNamespaceData.prefix; }); if (i != namespaces_.rend()) - { - cacheNSIds_[i->prefix]= i->nsId; return i->nsId; - } return NAMESPACE_UNKNOWN; } @@ -714,10 +706,7 @@ XmlReader::Result XmlReader::handleEndTag() { void XmlReader::handleElementEnd() { assert(!elements_.empty()); - // remove keys from cache that are no longer valid auto end = elements_.top().inheritedNamespaces; - for (auto i = end; i < namespaces_.size(); ++i) - cacheNSIds_.erase(namespaces_[i].prefix); namespaces_.resize(end); elements_.pop(); state_ = elements_.empty() ? State::Done : State::Content; |