Don't instantiate a QStringRef into a QString only to search in a QStringList
ClosedPublic

Authored by apol on Jul 26 2018, 11:27 AM.

Details

Summary

It's just not overloaded by QStringList, so we keep a local definition here.

Test Plan

tests still pass, discover still runs.

Diff Detail

Repository
R235 Attica
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
apol created this revision.Jul 26 2018, 11:27 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptJul 26 2018, 11:27 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
apol requested review of this revision.Jul 26 2018, 11:27 AM
aacid accepted this revision.Jul 26 2018, 5:29 PM
aacid added a subscriber: aacid.

Does this really make a difference?

Also... fix qt to get QStringList::containst(QStringRef)?

This revision is now accepted and ready to land.Jul 26 2018, 5:29 PM
apol added a comment.Jul 27 2018, 10:16 AM

Does this really make a difference?

I was looking at heaptrack and this function was a point of contention, maybe not a big deal.

Also... fix qt to get QStringList::containst(QStringRef)?

Last time I submitted a QStringRef overload to Qt, QStringView-man told me it was the wrong thing to do and he had everything figured out. I can do it though.

This revision was automatically updated to reflect the committed changes.
bruns added a subscriber: bruns.Jul 27 2018, 4:39 PM
bruns added inline comments.
src/parser.cpp
58

You could also use

if (std::any_of(elements.begin(), elements.end(),
                [&xml](const auto& e) { return e == xml.name(); }) {