[Toybox] New toy: grep
Rob Landley
rob at landley.net
Mon Feb 27 22:16:49 PST 2012
On 02/27/2012 03:08 PM, Andre Renaud wrote:
> However for toybox, I would assume that the preference would
> be for the smallest complete implementation, rather than a larger,
> faster one. So would that mean that a simplistic mmap + regexp + line
> counter be sufficient, even though its pretty hideous for the
> fixed-string common case?
I am interested in optimizing for the common case, but
readline/regex/free shouldn't be _that_ hideous. (We don't even have to
recompile the regex for each line.) Lemme implement, benchmark, _then_
worry about optimizing. (And if optimizing's to be done, the lookup
table stuff is about optimizing the regex implementation, which lives in
libc. The gnu guys love to reimplement libc, bash has its own malloc
implementation.)
Also, keep in mind that the current performance of get_line() is
appalling due to the single byte reads, so that's probably going to be
the immediate bottleneck anyway. (I have a todo item to revisit that,
but the current one works, so...)
And if you really need a bigger faster implementation, you can always
build the existing external one...
Rob
1330409809.0
More information about the Toybox
mailing list