reduce number of dracut-install calls
dracut-install has a slow start-up time on ARM devices. Alper Nebi Yasak wrote: "On my ARM64 Chromebooks dracut-install takes about 2-3 seconds to start up even for a single module." (see !102 (merged))
Instead of manual_add_modules
calling dracut-install
directly,
collect the wanted kernel modules in a temporary file. Call
dracut-install at the end on all modules in one go.
Move hidden_dep_add_modules
after the dracut-install
, because it
needs to read the installed kernel modules.
Benchmark results
All benchmarks were taken on my desktop machine in a tmpfs chroot with Debian unstable on 2024-05-28.
initramfs-tools 0.142 from unstable:
$ schroot-wrapper -p initramfs-tools,linux-image-generic,firmware-linux,zstd,cryptsetup-initramfs,lvm2,kbd,mdadm,ntfs-3g,plymouth,console-setup,hyperfine -u root -c unstable
(unstable)root@host:~# hyperfine -r 5 "update-initramfs -u"
Benchmark 1: update-initramfs -u
Time (mean ± σ): 14.092 s ± 0.022 s [User: 14.008 s, System: 7.106 s]
Range (min … max): 14.070 s … 14.121 s 5 runs
git master (commit 78d0471a):
$ schroot-wrapper -p ../initramfs-tools_0.142_all.deb,../initramfs-tools-core_0.142_all.deb,linux-image-generic,firmware-linux,zstd,cryptsetup-initramfs,lvm2,kbd,mdadm,ntfs-3g,plymouth,console-setup,hyperfine -u root -c unstable
(unstable)root@host:~# hyperfine -r 5 "update-initramfs -u"
Benchmark 1: update-initramfs -u
Time (mean ± σ): 12.064 s ± 0.028 s [User: 12.940 s, System: 6.019 s]
Range (min … max): 12.042 s … 12.110 s 5 runs
This commit:
$ schroot-wrapper -p ../initramfs-tools_0.142_all.deb,../initramfs-tools-core_0.142_all.deb,linux-image-generic,firmware-linux,zstd,cryptsetup-initramfs,lvm2,kbd,mdadm,ntfs-3g,plymouth,console-setup,hyperfine -u root -c unstable
(unstable)root@host:~# hyperfine -r 5 "update-initramfs -u"
Benchmark 1: update-initramfs -u
Time (mean ± σ): 11.329 s ± 0.027 s [User: 12.469 s, System: 5.803 s]
Range (min … max): 11.298 s … 11.362 s 5 runs
LP: #2065180