summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-09-23 19:42:56 +0200
committerLars Knoll <lars.knoll@qt.io>2020-10-05 09:57:13 +0200
commit313ed3d19ad41c2819265b4667bb7f28a024dd89 (patch)
tree9663cfdce8386d167c1856c743ddee8242ddce65
parent1b06c07115d7da4fb2af05d30647d822c3ccae7a (diff)
Use QStringTokenizer instead of QStringView::split
This nicely optimizes a hot spot when our HTML parser was loading Qt documentation. This change improves the loading time of the Qt Concurrent overview page by 30%, both over the previous commit and 5.15. Fixes: QTBUG-86354 Change-Id: I4f401c2e6048096444e482c7724e3e3a6c71516e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
-rw-r--r--src/gui/text/qcssparser.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index 24ad9d5092..3b2f8aaef0 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -2048,8 +2048,15 @@ bool StyleSelector::basicSelectorMatches(const BasicSelector &sel, NodePtr node)
return false;
break;
case QCss::AttributeSelector::MatchIncludes: {
- const auto lst = QStringView{attrValue}.split(u' ');
- if (!lst.contains(QStringView(a.value)))
+ const auto lst = QStringView{attrValue}.tokenize(u' ');
+ bool found = false;
+ for (auto s : lst) {
+ if (s == a.value) {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
return false;
break;
}