optimization work

David Zeuthen david at fubar.dk
Tue Oct 10 19:21:50 PDT 2006

On Sun, 2006-10-08 at 19:42 -0400, David Zeuthen wrote:
>         # time ./run-hald.sh --skip-fdi-install --exit-after-probing > /dev/null 2>&1
>         real    0m2.065s
>         user    0m0.572s
>         sys     0m0.624s

So, actually that's not a useful way of measuring stuff as it invokes
bash that later invokes hald.. Oh well.

So since Sunday night, I've

 - Reworked HalDevice to use a hash list for property access to get
   O(1) lookup instead of O(n) 

 - merged Kay's patch to create rule objects instead of loading 
   and parsing the same XML file a gazillion times (it literally
   disappeared from the profile, e.g. down from 25% to ~0%)

 - Looked a lot into the memory allocation patterns and put in some
   experimental code to reduce writable memory

Here's a sysprof profile


and a screenshot



 - Startup time is now 1.2 secs on my Thinkpad T41 1.6Ghz and 0.9 secs
   on my Macbook Pro 2GHz core duo
 - Writable memory down from 2.2MB to 1.4MB on both my systems

and there's still some low hanging fruit

 - make device object lookups O(1) instead of O(n) where n is number
   of device objects. Important for big iron with thousands of disks.

 - Do something clever for pci.ids and usb.ids - it's ca. 600kb of
   writable memory we can win

 - Use quarks for property names

Hard problems

 - Memory allocation is still somewhat mysterious; I think the big heap
   usage is due to fragmentation. Some people tell me that glibc malloc
   (which we use for glib strings) kinda sucks. I wish I had a tool to
   visualize the heap just like good old mempeeker on the Amiga


   Ah, those were the days.

 - D-Bus is starting to show up on the profiles a lot. News at 11.

Anyway, I think we're on the right track!


More information about the hal mailing list