[Patch] Speed up /usr/lib/vdr/plugin-loader.sh by a factor of 15

Michael Burian michael.burian at sbg.at
Sun Apr 6 10:01:51 UTC 2008


Some further testing revealed that there are cases where
the dlocate based solution I sent you yesterday ends up being just as 
slow as the dpkg -S based variant. (43 seconds)

That lead me to a different approach, which works like this:

1. use the cached result of the last dpkg -S run if it exists and is up
to date

2. else run the regular dpkg -S based version and cache it's result.

In order to determine if the cache is up to date, I'm using a
md5sum over all the plugins "*.so.*" and the cache file itself.
That way we can detect a single change in
a) plugin version
b) plugin installation status (newly installed, or removed)
c) cache file (in case somebody messed with it)
and regenerate the cache in all that cases.

I've attached a modified /usr/lib/vdr/plugin-loader.sh as patch
as well as plain file.

I'm using debian lenny and ctvdr 1.6.0

Performance: cache hit vs. cache miss = 3 vs. 43 seconds
on my 1.8 GHz Dualcore laptop.

Any feedback would be greatly appreciated!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: speed-up-plugin-loader-with-md5-cache.diff
Type: text/x-diff
Size: 1679 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-vdr-dvb-devel/attachments/20080406/4992278f/attachment-0001.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plugin-loader.sh
Type: application/x-sh
Size: 4976 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-vdr-dvb-devel/attachments/20080406/4992278f/attachment-0001.sh 


More information about the pkg-vdr-dvb-devel mailing list