fixdep: use hash table instead of a single array
authorEric Dumazet <eric.dumazet@gmail.com>
Tue, 9 Nov 2010 15:29:27 +0000 (16:29 +0100)
committerMichal Marek <mmarek@suse.cz>
Thu, 11 Nov 2010 16:12:06 +0000 (17:12 +0100)
commit8af27e1dc4e4dd7a7b04c2cd0fc3d419d91d45b0
tree0cf6febb82aafa421259a69007a6e848c3b9fa3c
parentd63f6d1b4d3ad0d88685a5f8eb1c3cac01ddd0db
fixdep: use hash table instead of a single array

I noticed fixdep uses ~2% of cpu time in kernel build, in function
use_config()

fixdep spends a lot of cpu cycles in linear searches in its internal
string array. With about 400 stored strings per dep file, this begins to
be noticeable.

Convert fixdep to use a hash table.

kbuild results on my x86_64 allmodconfig

Before patch :

real 10m30.414s
user 61m51.456s
sys 8m28.200s

real 10m12.334s
user 61m50.236s
sys 8m30.448s

real 10m42.947s
user 61m50.028s
sys 8m32.380s

After:

real 10m8.180s
user 61m22.506s
sys 8m32.384s

real 10m35.039s
user 61m21.654s
sys 8m32.212s

real 10m14.487s
user 61m23.498s
sys 8m32.312s

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
scripts/basic/fixdep.c