Faster UDevManager::devicesFromQuery
ClosedPublic

Authored by davidedmundson on Oct 26 2017, 11:54 AM.

Details

Summary

Avoid double-lookup in UdevManager::devicesFromQuery

The current code instantiates a list of Udev objects, creates a
stringlist of IDs discarding the backend devices. Then we loop through
creating a solid wrapper which then creates the Udev device by ID,
forcing udev to reload the data for that object again.

This code creates the solid wrapper directly from the original
UdevDevice list.

The isOfInterest check then needs to be added in this loop.
As it's slower than checking the type so this is done after
we check the types match.

Diff Detail

Repository
R245 Solid
Lint
No Linters Available
Unit
No Unit Test Coverage
Restricted Application added a project: Frameworks. · View Herald TranscriptOct 26 2017, 11:54 AM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript
davidedmundson planned changes to this revision.Oct 26 2017, 2:08 PM

Rewrite, changes less stuff.

davidedmundson edited the summary of this revision. (Show Details)Nov 28 2017, 12:56 PM
broulik accepted this revision.Nov 28 2017, 1:24 PM
broulik added a subscriber: broulik.
broulik added inline comments.
src/solid/devices/backends/udev/udevmanager.cpp
202

If you're getting a const list now, you could also use range-for

This revision is now accepted and ready to land.Nov 28 2017, 1:24 PM
This revision was automatically updated to reflect the committed changes.