uclibc getline is much slower than glibc

Khem Raj raj.khem at gmail.com
Mon Jun 20 21:34:38 UTC 2011


On Mon, Jun 20, 2011 at 1:11 AM, Denys Vlasenko
<vda.linux at googlemail.com> wrote:
> 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 :(
>

Looking at getdelim implementation of both I see that uclibc
uses a simple loop over characters in stream but glibc uses
memcpy and copies the characters in chunks. So essentially
it seems that with change to use readline the code remained
almost same for uclibc(execution wise) and hence the time should
remain same too as its seen in your runs with uclibc time does not change much

> Any volunteers to find out why it is so?
>
> --
> vda
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://lists.busybox.net/mailman/listinfo/uclibc
>


More information about the uClibc mailing list