Indulge me while a make a “note to self” about efforts to reduce the time taken by guestfs_launch which boots up the libguestfs appliance.
Create supermin appliance: This has crept up over time from originally taking about 1/5th of a second to around 2s.
qemu startup: The time is mainly spent reading in the large
|3s||BIOS waits for keypress: As discussed yesterday, I’ve posted a patch. In the meantime the qemu devs have abandoned the old bochs BIOS for SeaBIOS, which I haven’t tested yet,|
|3s||Kernel boot time: Not very many easy wins here, since the kernel is already pretty efficient. We could try to remove some busy waits and sleeps — for example the kernel waits ¼s for the serial ports, which we don’t use.|
|1-2s||Userspace boot time: This is mainly time spent on udev and partition detection. I have never really understood why the kernel needs to pause so long on partition detection. Not much easy meat here, but improving the speed of udev in itself would be worthwhile.|
I spotted a nice tool for turning strace output into timelines.
Update — bash globbing
Having solved the cpio problem, the largest bottleneck in creating the supermin appliance becomes globbing.
It’s probably not a well-known fact, but if you do:
ls *.c *.h
then bash reads the directory twice. It treats the two globs on the command line as completely separate entities. This is not so bad for a few globs, but when we make the supermin appliance we need to do over 120 globs, which takes bash about 0.8s to complete, contributing about 10% to the overall launch time. Bash is literally reading the same directory over and over again, 50 or more times.
At the moment it’s not obvious to me how to solve this.