On 15/06/2011 06:57, Timo Teräs wrote:
> Rabbit hole goes deep. It's the whole family of reading lines in libbb
> that's brain damaged this way. xmalloc_fget*.
> 
> In the sources there's even faster versions, disabled for some reason.

Sorry that I didn't manage to explain things more clearly - I got
somewhere near where you are now but there is some subtlety in figuring
out how to proceed.  There appears to be some attempt to make the line
reader generic and split on nulls, \n, \\, etc - however, that appears
to have prevented several attempts at optimisation?

Readline does seem very tempting for platforms where it's supported..?

> I also remember that there was issue with fgets, that it didn't detect
> NUL bytes properly, and was broken if the file has \0 and or \n as
> separator.

Grep-ing on where the functions are used shows not so many places...
Where it is used it's used as several different synonmys, all of which
basically boil down to the same line reader...

> It seems that the whole API of reading lines needs a rework, and it
> would speed up a bunch of bb tools.

I think sed caught my eye as the main likely beneficiary?

Thanks for looking into this further!

Ed W

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to