Optimization operator

I have introduced this to quite a few colleagues in a form of question “what is the optimization operator in C++/PHP/…?”
The answers varied a lot, people would come up with branch prediction stuff (likely(),etc), and many other ideas, though never right ones.
The answer was pretty straightforward. It works in quite a lot of programming languages:

//

Simply commenting out code optimizes things better than any other way. Go, try it.

This entry was posted in wikitech and tagged , . Bookmark the permalink.

3 Responses to Optimization operator

  1. Brilllliant. The fastest code is the one that does not run, etc.

    +1 optimization points for you!

  2. Looks like python guys are missing the optimization operator! Now that’s a bug. But at least we have a true floor division which saves us from these long ugly optimization free IEEE 754 numbers.

  3. Toby says:

    au contraire, Python has the equivalent: #

    But this is hardly a new idea. FORTRAN has ‘C’, BASIC has ‘REM’, and even many humble assemblers have ‘;’. More to the point, MySQL has ‘–’ (and ‘#’ too).

    Another powerful optimisation trick: ‘rm’

Comments are closed.