[Patch] Speed up /usr/lib/vdr/plugin-loader.sh by a factor of 20
Michael Burian
michael.burian at sbg.at
Fri Apr 4 21:53:34 UTC 2008
Dear VDR Maintainers,
On my Laptop: (1.8 Ghz Dualcore Centrino, 1GB RAM, SATA Harddisk, Debian
Lenny) it takes 40+ seconds till the whole plugin handling is done.
After tracking down the issue "dpkg -S" looked highly suspicious.
To rule out any other issues that might cause the horrible performance I
booted into single user mode (init=/bin/bash) and did a
time dpkg -S /usr/bin/bashbug
which took, about 41 seconds for the first run on a fresh booted
system.
Using strace to see what's going on behind the scenes I found out that
"dpkg -S" involves reading all those little /var/lib/dpkg/info/*.list
files. (which turn out to be 2822 files / 26MB disk usage on my laptop)
bootchart also showed heavy IO during those 41 seconds
Fortunately there are less IO intensive ways to get that kind of
information. This is where my patch comes in:
About the patch:
1. dlocate is used if available
2. dpkg is used if dlocate is not available
3. vdr package should "Suggests:" or maybe even "Depends:" on dlocate
4. Is really necessary to always perform an update-dlocatedb?(+0.6 secs)
5. Does it make sense to inform the user that dlocate is used?
(or would it make sense to recommend installing dlocate in case
the user is experiencing slow start up behavior?)
Performance:
initial start up:
a common case, usually we aren't restarting vdr all day long
dpkg -S 41 seconds
dlocate -S 2 seconds
After the initial run dpkg might be a bit faster, likely due to the fact
that files that are already cached in memory and no update-dlocatedb is
performed in that case. (See 4.) Compared to the initial delays that
difference is appears to be negligible, however.
What do you think about it?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: speed-up-plugin-loader.diff
Type: text/x-diff
Size: 1043 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-vdr-dvb-devel/attachments/20080404/2391b91b/attachment.diff
More information about the pkg-vdr-dvb-devel
mailing list