Programming as if Performance Mattered (2004)
dadgum.com
dadgum.com
What galls me is that they assume, without any basis, that the person has not (a) benchmarked the code, (b) is obviously running an inferior algorithm and (c) just because they have not worked on an applications were speed mattered, the poster could not possibly be working on something where speed matters. If I were the one who asked the question I would be mighty pissed, given that just reading such comments as a third party irritates me enough.
The advice about premature optimization is valid. But it is a well assimilated folklore by now and I dont see how repeating that adds value. I think Hoare and Knuth's message was intended for a specific audience and the majority of the online crowd is not that audience.This message is often interpreted by enlightened newbies as an encouragement to be sloppy.
People would be better served if the discussion shifted to a different landscape, where people pointed out that particular construct that was typically more efficient among constructs of comparable clarity. Pointed out possible bottlenecks ahead of time, so that it is on the developers mind and he/she does not have to go through the process of coding a poor solution and discovering that it sucks.
Also regardless of the fact whether the code construct is actually a bottleneck in the application or not, it is always good to know what the more efficient alternatives are. It might not be the bottleneck in the current application, but it might well be in some other. Besides, there is something called intellectual curiosity.
One can always ask for more information, so this is no excuse, of course. Perhaps the patronizing answers are the stupid mode of requesting clarifications.
"Pay attention", not as in squeeze out every extra cpu cycle they can, but as in do the 10 % extra thinking that would get the reasonable 2-10 fold improvement over the naive implementation. At least that's my experience - maybe i'm just really bad with my naive implementations, YMMV.
[1]http://en.wikipedia.org/wiki/Orders_of_magnitude_%28computin...
Just kidding, of course. If you're pointing at the poor performance of Flash Video on a Mac, I think the video decoder is written in C or C++, it was just... not really optimized: http://blogs.adobe.com/conversations/2010/02/open_access_to_...
The high CPU usage is typically because of two things:
1) Flash has to do extra compositing to add ads and such onto video.
2) Flash typically doesn't use hardware acceleration for the actual blitting -- their excuse is that on a significant % of computers, bad drivers will result in crashes, and they'd rather be somewhat slow on 100% of computers than crash 1% of them.
If you want something to complain about, go after the sites using Cortado to decode video. Yet even that is still JIT'd, though completely lacking SIMD asm due to being Java.
Disclaimer: I am not a developer of Flash, I just know one.
Really the only place its not important is GUI programming and high-level application logic.
We're wiser now. These days, performance can only be increased by adding more cores, not by clocking up. Scaling up actually costs development effort. This makes optimization very important.
See also this 2005 article from Dr Dobbs: http://www.gotw.ca/publications/concurrency-ddj.htm . That's when the big change of perspective began.
The link you posted is great; the chart alone speaks volumes! Already at that point in time one could notice how the trend with power and CPU frequency was changing, while transistor count kept on growing. James Hague would have had second thoughts, I believe, if he had seen that chart. Moore's Law suffered quite a plot twist the last decade.
(Curiously, Herb Sutter is the secretary of the C++ standards committee. They finally finished the standardization of basic threading — among other stuff — 5 years after the Dr. Dobbs article!)
The slow push for standardization is indeed curious. Standardizing threading would only be the beginning, as threading is (for most things) a much too low-level abstraction. It is very hard to scale threading, with the locking and other synchronization it usually entails, to large number of cores (soon, >16 won't be that strange). And it's very bug-prone.
I think it's disappointing that more high-level primitives such as co-routines, work queues, task-based parallelism, map/reduce and such are finding such slow adaption in mainstream languages. You'd say that making the writing of parallelized code faster and more robust is an important goal.