[Kde-hardware-devel] Hotplug dataengine performance

Jacopo De Simoi wilderkde at gmail.com
Fri Dec 18 12:04:57 CET 2009


Dear Hardware-devels, 
  even after the caching work by ervin & aseigo I was experiencing serious performance issues with the hotplug dataengine;
and serious meant that each device takes ~500ms to show up 

I finally tracked it down: it turned out it was spending ~50ms on each check for the "ignored" property; 
the problem is the implementation of HalVolume::isIgnored(); the first two lines read as follows:

HalDevice lock("/org/freedesktop/Hal/devices/computer");
bool isLocked = lock.property("info.named_locks.Global.org.freedesktop.Hal.Device.Storage.locked").toBool();

hence for each check of "ignored" we /create/ a new device for computer (~25ms)
and then we check the property (~25ms), obviously hitting a cache miss since the device has just been created :-/

Since pretty much every predicate checks for ignore and you easily get to the ~500ms per device that I was experiencing.
HalVolume doesn't have a d-ptr, so I could only come out with the following patch, which is ugly, but does the job pretty well

-    HalDevice lock("/org/freedesktop/Hal/devices/computer");
+    static HalDevice lock("/org/freedesktop/Hal/devices/computer");

now I'm down to ~50ms per device \o/
Please let me know if there's a better way to implement the patch.
Regards

   --J


More information about the Kde-hardware-devel mailing list