Quote:
Originally Posted by
verdepollo
I thought GNU grep was the
crème de la crème of speed.
In my system (GNU grep 2.6.3) it behaves better using an anchor than without it.
The original author (who does not maintain it any longer)
has thoroughly defended it. Not sure if after all these years it has been beaten by something else.
I'm not sure how much stock you can put in a 2 year old message written by someone that states that it's been 15+ years since they maintained the code (so 17+ at this time) and who points out the implementation has dropped what was once a default optimization (mmap). Aside from changes in the implementation with which they are (were?) familiar, there may have been changes to other implementations in the past 2 years.
GNU grep may very well be the best performing grep. I did not compare grep implementations and I wasn't suggesting that any implementation is faster than another. My point was only that implementations can differ quite a bit (even between different versions of the same implementation).
That said, GNU Anything is usually known for being quite slow (sometimes very slow). To be fair, one of GNU's primary goals (politics aside) is to support many platforms; while a BSD implementation is only concerned with its native platform. This leads to many more instances of conditional inclusion and abstractions in GNU implementations. Further, GNU projects tend to be much more liberal with feature extensions, which further complicates their code. On the flipside, the performance of some BSD implementations benefits from their lack of support for multibyte characters and locales, which some may consider a drawback.
A representative example:
GNU head (about a thousand lines)
OpenBSD head (about a hundred)
Also, proactively, I'd like to highlight the distinction between a BSD tool on a BSD kernel and its GNU counterpart on a Linux kernel. Such a comparison is apples and oranges. Both utilities would need to be run on the same kernel to achieve a meaningful comparison.
Please don't misconstrue this post as a salvo in a BSD-GNU war. It is no such thing. It is simply my view on the relative performance and complexity of BSD and GNU tools. Nothing more. Whichever you prefer, it is of no importance to me.
Regards,
Alister