http://qs1969.pair.com?node_id=681188


in reply to Re^2: CPU cycles DO NOT MATTER!
in thread CPU cycles DO NOT MATTER!

Sure. Algorithms can matter. But, they only do so now when dealing with large datasets

But "large" depends strongly on the algorithm.

I remember reading a node here (can't find it, sorry) about a regex taking exponential time matching some piece of HTML.

For an algorithm that needs exponential time a line of 80 chars can be long. Really. In 10 years that limit might be 100. Or 120.

Typical examples are the knapsack problem that appear in real world applications over and over again, which takes exponential time when solved with brute force. Approximation algorithms can solve it much faster, even if a bit inaccurate.

I'm sure even you would argue that you should optimize when a O(2**n) code hits you.

But if you normally don't optimize, you have no feeling for what is slow and what isn't, don't know about profiling etc. Which is why I do optimize my applications from time to time.

BTW a real world project that has been hit by missing optimizations recently is the KindaPerl6 compiler, which was so slow during bootstrap that it just wasn't practicable anymore. It took the fun out of the development process, and now I haven't seen a single kp6 commit since... lemme check... 2008-03-16. (Surely this wasn't the only problem, but IMHO it was the one with largest impact).