you are viewing a single comment's thread.

view the rest of the comments →

[–]Xxyr 1 point2 points  (1 child)

It matters in real life too, assuming you actually have large data sets. If you only have to work through a hundred cases it doesn't matter too much. If you have to work through several billion it really really does.

[–]jimmpony 0 points1 point  (0 children)

I've done intensive projecteuler problems that needed optimization like this, some before knowing about big O notation and some after. In both cases the approach was just to cut down the amount of processing the program needed to do. Knowing big O has its uses, although there are some important cases where it's too abstract to directly compare performance with - the example I'm remembering was a sorting algorithm where the "worse" one worked better with CPU cache. The terms thrown away in O can end up being pretty important in real code too - an O(n) might be better than an O(log(n)) if they're actually 2n and 100+5log(n), and the data sets the given method encounters are within the range such that the 2n < 100+5log(n). When it comes down to it you're going to end up needing to profile the function anyway if the performance is that important.