The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Compiler optimisation flags

I did a little experiment to see what effect VS2005/GCC compiler optimisation flags had on the genetic algorithm in my software. The results are here if anyone is interested:

I am wondering how robust these results are across different PCs and application areas (e.g. heavy floating point calculations). Has anyone tried something similar and got different results?
Andy Brice Send private email
Tuesday, December 18, 2007
As you yourself mentioned in the article, "Measuring is the only way to tell".

In my experience, people tend to prefer using rules-of-thumb rather than actually "measuring".  So I haven't seen a whole lot of use of Profilers.

I'd be surprised if there were any "common" results, though.  I believe Compiler Technology, especially the optimizations used, tend to change from release to release and vendor to vendor.

Still, knowing the results of other such "comparative" studies would be useful.
Tuesday, December 18, 2007
Here's a recent thread about compiler flags related to std::vector in C++.

Take homes: measure, and read the documentation.
Michael Gibson Send private email
Tuesday, December 18, 2007
Interesting. I am surprised that _SECURE_SCL is defined by default. But I don't use STL myself.
Andy Brice Send private email
Tuesday, December 18, 2007
Something else to not forget when trying to squeeze performance out of your compiler.  At least in VS there are code decorations you can add like no alias and restrict. declaring a function noalias tells the compiler that your pointers don't alias and so they can be optimized better.  restrict tells the compiler that the function is pure and doesn't modify global state.
Saturday, December 22, 2007
Andy Brice> Most of the optimisation between od and o1 comes from not adding the debug code & checks I believe.

Regarding std::vector: it should be slower than using bare pointers. One thing that jumped at me in the example is postincrementing iterators (this may or may not be optimized away). Anyway, profiling really is the best idea in these cases.
Wednesday, December 26, 2007

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz