Perf: Do expensive regexp construction earlier
ClosedPublic

Authored by kfunk on Nov 19 2018, 8:32 PM.

Details

Summary

SystemTray::serviceRegistered is called tons of times; the regexp
construction inside the for-loop is expensive and should be avoided.
Thus construct the regexp once, and re-use the regexp object each time.

Test Plan

Before:

After:

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kfunk created this revision.Nov 19 2018, 8:32 PM
Restricted Application added a project: Plasma. · View Herald TranscriptNov 19 2018, 8:32 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
kfunk requested review of this revision.Nov 19 2018, 8:32 PM
kfunk edited the test plan for this revision. (Show Details)Nov 19 2018, 8:32 PM
davidedmundson accepted this revision.Nov 19 2018, 11:31 PM

FWIW, if we use the new https://codereview.qt-project.org/#/c/225432/ we can both remove the regex and have all the filtering done in dbus-server which will save even more

This revision is now accepted and ready to land.Nov 19 2018, 11:31 PM
apol added a subscriber: apol.Nov 20 2018, 1:17 AM
apol added inline comments.
applets/systemtray/systemtray.cpp
88–90

Shouldn't we prefer QRegularExpression?

kfunk marked an inline comment as done.Nov 20 2018, 8:52 AM
kfunk added inline comments.
applets/systemtray/systemtray.cpp
88–90

Thought the same, but the new QRegularExpression doesn't allow wildcard matching.

This revision was automatically updated to reflect the committed changes.
kfunk marked an inline comment as done.