On Mon, May 12, 2014 at 12:34 AM, FRIGN <[email protected]> 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.
Kind regards,
Hiltjo