pioneerspacesim/pioneer — pull request #2711 by fluffyfreak (2014-02-02 16:19:09+00:00)
Title: To Discuss - do not merge.

Replace all calls to std::min and std::max with FastMin and FastMax template functions.

Based on information from the article http://randomascii.wordpress.com/2013/11/24/stdmin-causing-three-times-slowdown-on-vc/

This is a problem only for Visual Studio developers... how many time have we all read that now? Anyway it turns out that VS will spew forth terrible assembly code when using std::min & std::max. Since there's no harm to other compilers by replacing them with templated min/max methods which return by value that's exactly what I've gone ahead and done here.

We use std::min and std::max everywhere, in some really intense bits of code including collision and bvhtree generation. My, entirely-subjective, testing feels faster but I haven't sought out any hard numbers yet.

I wanted to get peoples opinion on making this change before I subject it to a couple of hours of scrutiny. Would there be any objections to replacing std calls just for VS developers? The binary builds that people can download are built with gcc which already optimises the return value where appropriate so it will only affect those of us using a VS compiler.

Andy