- Avoid double lookup (contains+value)
- Just delete take() instead of contains+value+remove+delete
- Delay connecting to DBus change signals (this is done in other places, too)
- Use range-for
- Use iterator's key() instead of creating temporary keys() list
Details
Details
- Reviewers
davidedmundson - Group Reviewers
Frameworks
It creates 22 device backends on Dolphin startup, delaying connecting to later saves 1.5ms startup in total.
- Devices still properly populated
- Mounting and unmounting devices still updates places list live
Diff Detail
Diff Detail
- Repository
- R245 Solid
- Lint
Lint Skipped - Unit
Unit Tests Skipped
src/solid/devices/backends/udisks2/udisksdevicebackend.cpp | ||
---|---|---|
67 | What do we gain by delaying dbus connection? |
src/solid/devices/backends/udisks2/udisksdevicebackend.cpp | ||
---|---|---|
67 | Similar code in different place had a comment // Delay connecting to DBus signals to avoid the related time penalty // in hot paths such as predicate matching |
src/solid/devices/backends/udisks2/udisksdevicebackend.cpp | ||
---|---|---|
67 | Never trust existing code. You're not going to get to process DBus events until we hit the event queue anyway. |
Comment Actions
The important stuff (double/triple lookup) was already committed elsewhere and the rest is just minor coding style stuff
src/solid/devices/backends/udisks2/udisksdevicebackend.cpp | ||
---|---|---|
67 | Its also clearly racy. You have to connect to the signals before initializing the list of interfaces. Otherwise the following lets you end up in an undefined state:
|