News for hackers. Stuff that matters.
Re:Go vs C++: Ray tracer (part 3) by bluecalm on Saturday October 05, 2013 @04:26AM (#6499981)
Few remarks:

-mtune is redundant with march=native turned on;

-use -Ofast instead O3/ffast-math it turns some more options as well (although theoretically it might behave in non-standard way with float computations, you need to test this, it wasn't ever a problem for me)

-add -flto it often helps significantly

-it probably won't matter for simple program but you may try compiling with: -Ofast -march=native -flto -fprofile-generate; then run the program (it will generate .gcda files) and then recompile with the same options and -fprofile-use;

EDIT: Some quick tests shows that all the options I mentioned help (MinGW, gcc 4.8.1). Original time on one thread was 3.670s, Ofast and -flto takes it to ~3.630s and adding PGO moves it to 3.46s (there is some variance with all of those) - whooping 5-6% improvement overall :)

Re:Go vs C++: Ray tracer (part 3) by bluecalm on Saturday October 05, 2013 @08:40AM (#6500503)
I can't edit anymore, so replying to myself:

On my machine (i7 3770) inserting famous Quake3 hack in place of 1/sqrtf: http://en.wikipedia.org/wiki/Fast_inverse_square_root is faster but not accurate with one iteration (image is very distorted) and slower but accurate with 2 iterations.

Re:Go vs C++: Ray tracer (part 3) by twoodfin on Saturday October 05, 2013 @09:57AM (#6500668)
How would -flto help when all the code is in one module?
Re:Go vs C++: Ray tracer (part 3) by bluecalm on Saturday October 05, 2013 @12:07PM (#6501076)
All I know about gcc flags is from testing a lot of combinations of them. I don't really know how -flto works but maybe it does something for functions from included files ?