From 313ed3d19ad41c2819265b4667bb7f28a024dd89 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 23 Sep 2020 19:42:56 +0200 Subject: [PATCH] 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 --- src/gui/text/qcssparser.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 24ad9d5092b..3b2f8aaef07 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; }