Just a fraction better (with -a and LANG=C)

Ran it multiple times, stays just under 6 seconds now:

real    0m5.835s
user    0m5.720s
sys     0m0.060s

Still a far cry from the original / other results (under a second).
The logfile it greps is valid XML data.

Jan


Op wo 14 nov. 2018 om 15:19 schreef Santiago Ruano Rincón <
[email protected]>:

> Dear Jan,
>
> El 13/11/18 a las 17:09, Jan van den Berg escribió:
> > Package: grep
> > Version: 2.27-2
> > Severity: normal
> >
> > Dear Maintainer,
> >
> > I just upgraded from Debian 8 to 9 and noticed that a script which I run
> > several times per day was really slow:
> >
> > real    0m6.384s
> > user    0m6.288s
> > sys     0m0.036s
> >
> > This used to take well under a second.
> >
> > I dug a little deeper and noticed the problem was here:
> >
> > grep 'best_bid\|fixed_' /var/www/logs/large_log_file
> >
> > Playing around with the grep parameters en locale settings, and narrowed
> it
> > down to the regex, because this is way faster:
> >
> > grep -F best_bid /var/www/logs/large_log_file
> > grep -F fixed /var/www/logs/large_log_file
> >
> > So much faster in fact, that I can run 2 grep command faster than one.
> >
> > real    0m0.199s
> > user    0m0.108s
> > sys     0m0.032s
> >
> > However, this is strange and unexpected that after an upgrade a
> > unaltered grep script is slower. I dug a little deeper and it seem
> related to #761157
> > (and #18454) because of a change in de PCRE library between jessie and
> > stretch.
>
> I am not sure of that, since you are not using the -P matcher that
> relies on libpcre3.
>
> >
> > I have not seen a real fix yet (other than altering my script/grep
> commands), but I expect the regex library needs work, to match the previous
> behaviour so therefore I'm deeming it a 'bug'?
> …
>
> There have been behaviour changes between the version of grep released
> in jessie and stretch. See e.g. #891086.
>
> Could you please run your script with the -a option, and also setting
> LANG=C ? I suspect there is a non-textual file, a multi-byte encoding,
> or a wrong encoding causing your problem. Before going any further,
> please check that.
>
> Cheers,
>
> Santiago
>

Reply via email to