uclibc getline is much slower than glibc

Ed W lists at wildgooses.com
Wed Jun 22 14:11:55 UTC 2011


On 20/06/2011 22:34, Khem Raj wrote:
> 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

Hi, This speed effect was most noticable to me in calling modprobe which
read in a mere 100KB file, but was taking > 1/20th of a second to do
so... (Do it a few times and you have a lot of wait time)  In the case
of busybox the same line reading code also affects interesting utilities
such as sed. Probably other code trying to read largish files would also
benefit from speedups to this code?

What would be the objections to switching to a glibc style
implementation with memcpy? It seems like a reasonably easy function to
show it's somewhat performance hindered - is any additional code/memory
usage reasonable for the performance increase? Any reason why we can't
simply swipe the glibc implementation?

Thanks

Ed W


More information about the uClibc mailing list