Why GNU grep is fast (2010)
31–40 of 133 posts
Re: Why GNU grep is fast (2010)
#32what is grep?
Re: Why GNU grep is fast (2010)
#33what is grep?
Re: Why GNU grep is fast (2010)
#34This applies very well to optimization, too. There are only really two ways to optimize code: 1) make it do less 2) make it do more at a time. The first corresponds to using more efficient algorithms and data structures. The second is parallelism.
Or vectorization, or avoiding stalling, or filling all execution units, or...
Re: Why GNU grep is fast (2010)
#35Earlier quoted context omitted.
> "The fastest method to execute is an empty method." The fastest method to execute is an empty method that was never called. The fastest method to execute is an empty method that was never called and never written. The fastest method to execute is an empty method that was never called and never written and never planned.
This is why I say I'm at my most efficient when I just don't do any work at all.
Re: Why GNU grep is fast (2010)
#36In case you're interested to see what older HN contributors had to say about this, here are some of the previous submissions, all of which have significant discussion: https://news.ycombinator.com/item?id=1626305 , 1193 days ago, 115 comments https://news.ycombinator.com/item?id=2393587 , 972 days ago, 68 comments https://news.ycombinator.com/item?id=2860759 , 842 days ago, 43 comments ( ionelm also pointed out a pre…
Re: Why GNU grep is fast (2010)
#37This applies very well to optimization, too. There are only really two ways to optimize code: 1) make it do less 2) make it do more at a time. The first corresponds to using more efficient algorithms and data structures. The second is parallelism.
It is never a good idea to rush any large coding project. By rush, I mean just sit down and start churning out code just so you can have something tangible within a day or two. And by large, I mean anything requiring at least a few thousand LOC. Anything less can be okay to rush though; i.e., small projects where maintainability and scalability aren't as important; e.g., some MVP to test some market.
Re: Why GNU grep is fast (2010)
#38Re: Why GNU grep is fast (2010)
#39In case you're interested to see what older HN contributors had to say about this, here are some of the previous submissions, all of which have significant discussion: https://news.ycombinator.com/item?id=1626305 , 1193 days ago, 115 comments https://news.ycombinator.com/item?id=2393587 , 972 days ago, 68 comments https://news.ycombinator.com/item?id=2860759 , 842 days ago, 43 comments ( ionelm also pointed out a pre…
http://swtch.com/~rsc/regexp/regexp1.html
http://swtch.com/~rsc/regexp/regexp2.html
http://swtch.com/~rsc/regexp/regexp3.html
http://en.wikipedia.org/wiki/Thompson%27s_construction_algor...
I implemented a sort of micro-grep in the past using the Thompson's algorithm, it was a great exercise in practical applications of heavily-theoretical CS stuff, with recursive-descent parsing of the regular expression, then using Thompsons algorithm to create a NFA out of the parse tree, then a simulation of an NFA with a DFA using two stacks. I used the Dragon Book for reference on this, all pretty awesome stuff.