Re: Too slow readln

2017-07-16 Thread Ali Çehreli via Digitalmars-d-learn

On 07/16/2017 10:37 AM, Jon Degenhardt wrote:


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


Another fast GNU utility was on Reddit a month ago:


https://www.reddit.com/r/programming/comments/6gxf02/how_is_gnus_yes_so_fast_xpost_runix/

Ali



Re: Too slow readln

2017-07-16 Thread unDEFER via Digitalmars-d-learn
I understand the main problem. dirEntries by default follows 
symlinks.

Without it my first grep works only 28.338s. That really cool!


Re: Too slow readln

2017-07-16 Thread unDEFER via Digitalmars-d-learn

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 .`


Re: Too slow readln

2017-07-16 Thread Jon Degenhardt via Digitalmars-d-learn

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