Bug#273433: [Logcheck-devel] Bug#273433: logcheck: odd behaviour with perdition rules

maks attems debian at sternwelten.at
Tue Oct 12 19:42:55 UTC 2004


On Tue, 12 Oct 2004, Gerfried Fuchs wrote:

> * maks attems <debian at sternwelten.at> [2004-09-27 10:36]:
> > but if you look at the code:
> > $SORT -m $TMPDIR/logoutput/* | uniq | sed -e 's/ *$//' | cat \
> >     > $TMPDIR/logoutput-sorted \
> > we strip using sed any trailing whitespace in the logfile.
> 
>  Wouldn't a "sed -e 's/ +$//'" be perform better? Can someone do a quick
> benchmark on that?  It might be needed to use 's/ \+$//' or similar, but
> I guess you get the idea.

you are right that your choice performs better on bigger files:
$ time sed -e 's/ +$//' src/debian-installer/packages/po/fr.po > /dev/null

 real    0m0.161s
 user    0m0.155s
 sys     0m0.004s

$ time sed -e 's/ *$//' src/debian-installer/packages/po/fr.po >
/dev/null

real    0m0.311s
user    0m0.301s
sys     0m0.004s
 
>  This might help us improving the throughput a little bit. That way it
> only does the sed when it really applies, not for every line. Also,
> don't we really want to stripp '[[:space:]]' instead of ' ', that is,
> including tab stops?

correct code loses a bit of advantages

$ time sed -e 's/[[:space:]]+$//' src/debian-installer/packages/po/fr.po >
/dev/null

real    0m0.248s
user    0m0.165s
sys     0m0.004s

but again much better than:
$ time sed -e 's/[[:space:]]*$//' src/debian-installer/packages/po/fr.po >
/dev/null

real    0m0.432s
user    0m0.416s
sys     0m0.005s

 
>  Just a thought.
> Alfie

thanks i'll fix that up!

> P.S.: Finally uploaded logcheck for woody today, unfortunately it got
>    tagged as NMU because I'm not in the uploaders field, but I'll send
>    the -done message the next days, when I've got Joey's ACK again for
>    accepting the package into the next point release.

great :)

a++ maks





More information about the Logcheck-devel mailing list