]> git.ipfire.org Git - thirdparty/kmod.git/commit
depmod: Write index in pre-order
authorTobias Stoeckmann <tobias@stoeckmann.org>
Wed, 16 Oct 2024 19:38:04 +0000 (21:38 +0200)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Wed, 13 Nov 2024 14:56:11 +0000 (08:56 -0600)
commitdada048cbf575ccc3c70305392d28f29ca284680
tree31a68578cda24531a55802be9cb155780d1ad484
parenta076809c9635fa0f556ad933deb9b4493e1ca74b
depmod: Write index in pre-order

Index files in pre-order have a significant performance improvement
for libkmod users.

On Arch Linux system, dumping configuration takes 296 read calls
in pre-order, compared to 4080 in post-order. Tests on a Raspberry
Pi 2 test system have shown an improvement by 9 %.

Even writing is faster now. This happens because we must know in
advance how many bytes index nodes will consume in the resulting file.
Although this code calculates it on the fly and caches the results,
saving lseek system calls has a significant positive effect which
compensates this extra overhead.

On Arch Linux system, writing index takes 6143 lseek calls now, compared
to previous 83701, leading to a performance gain of 13 %.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/188
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
tools/depmod.c