Too slow readln

unDEFER via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 16 10:56:08 PDT 2017


On Sunday, 16 July 2017 at 17:37:34 UTC, Jon Degenhardt wrote:
> On Sunday, 16 July 2017 at 17:03:27 UTC, unDEFER wrote:
>> [snip]
>>
>> How to write in D grep not slower than GNU grep?
>
> GNU grep is pretty fast, it's tough to beat it reading one line 
> at a time. That's because it can play a bit of a trick and do 
> the initial match ignoring line boundaries and correct line 
> boundaries later. There's a good discussion in this thread 
> ("Why GNU grep is fast" by Mike Haertel): 
> https://lists.freebsd.org/pipermail/freebsd-current/2010-August/019310.html
>
> --Jon

Thank you. I understand yet another trick:
$ find . -exec file -bi {} +
is the same
$ file -bi `find .`


More information about the Digitalmars-d-learn mailing list