uclibc getline is much slower than glibc

Denys Vlasenko vda.linux at googlemail.com
Mon Jun 20 08:11:50 UTC 2011


Hi Bernhard,

I committed a fix to busybox:
http://git.busybox.net/busybox/commit/?id=adcabf3235a13e77a32ff2a7b7cf80be8ee3dfe3

which makes it use getline in config parser.

I use this script (called z) to modprobe a non-existent module 1000 times:
#!/bin/sh
i=1000
while test $((--i)) != 0; do
        $1 modprobe qwertyui
done

With glibc, speedup is much bigger than with uclibc:

glibc (before and after):

# time ./z ./busybox 2>/dev/null
real    0m7.616s
user    0m6.568s
sys     0m0.489s
# time ./z ./busybox 2>/dev/null
real    0m3.468s
user    0m2.477s
sys     0m0.583s

uclibc:

# time ./z ./busybox 2>/dev/null
real    0m5.645s
user    0m4.632s
sys     0m0.426s
# time ./z ./busybox 2>/dev/null
real    0m5.376s
user    0m4.692s
sys     0m0.362s

The builds are different in that uclibc is a static build w/o
threads whereas glibc is a "typical" build, which explains
why before the change, uclibc was faster.

But after the change, glibc is not only faster than it was,
it also now beats uclibc by a wide margin :(

Any volunteers to find out why it is so?

-- 
vda


More information about the uClibc mailing list