Re: [dev] [sbase] [PATCH] Make grep more memory-efficient

From: Dimitris Papastamos <sin_AT_2f30.org>
Date: Mon, 12 May 2014 12:07:03 +0100

On Mon, May 12, 2014 at 12:57:57PM +0200, Hiltjo Posthuma wrote:
> On Mon, May 12, 2014 at 12:34 AM, FRIGN <dev_AT_frign.de> wrote:
> > Hello,
> >
> > previously, we allocated one regex_t for each pattern found.
> > This gets pretty nasty once the tree of patterns grows.
> > Reusing one regex_t and regfreeing it after each use inside grep()
> > implies just one simultaneous element in memory and a drastic decrease
> > in memory-consumption.
> >
> > Please let me know what you think!
> >
>
> (Re)compiling the regex for each line doesn't make sense (imho) and
> slows it down alot.
>
> A simple test:
>
> time seq 1 100000000 | grep 'a'
>
> sbase grep (before patch):
> 0m22.21s real 0m0.00s user 0m0.00s system
>
> sbase grep (after patch):
> 2m16.28s real 0m0.00s user 0m0.00s system
>
> coreutils grep:
> 0m1.15s real 0m0.00s user 0m0.00s system
>
> So the patch should be reverted I think.

Thanks for your input. The patch has been reverted.
Received on Mon May 12 2014 - 13:07:03 CEST

This archive was generated by hypermail 2.3.0 : Mon May 12 2014 - 13:12:12 CEST