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>
This commit is contained in:
Lars Knoll 2020-09-23 19:42:56 +02:00
parent 1b06c07115
commit 313ed3d19a

View File

@ -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;
}