vvbee wrote:Someone should benchmark the compilers' perf optimizations. For dos, could include borland, digital mars, and watcom. Maybe for win 9x the latter two and gcc. Use a software rasterizer or whatever.
I compiled a modified version of the smallpt path tracer using a few win32 compilers to see whether there would be notable differences in execution speed. The program rendered a 40 x 30 image with a ray depth of at most 4. Floats were double-precision. I was going to repeat the test for dos, but the dos version of the code stopped working at some point and I couldn't be bothered.
Compilers: borland c++ 5.5 (-5 -P -f -O2 -O -tWC), digital mars c++ probably the newest version (-mn -a8 -5 -cpp -c -f -o+speed), gcc 4.7 (-O3), and open watcom 1.9 (-oneatx -oh -oi+ -ei -zp8 -5 -fpi87 -fp5). The optimizations targeted the pentium level (not ppro), were to use hardware x87, and were not to enable ieee-breaking fp. None of these are guaranteed to have happened. I especially didn't look at the open watcom settings too close and just copied them from a website. Didn't care at all about gcc's. It's unclear whether -f for the borland allows true x87 or just emulation. No doubt you can devise faster/better options, so let loose and do a repeat.
In general, gcc produced the fastest executable, followed by the digital mars compiler. Borland's was the slowest.
Machine: 300 mhz k6-2, windows 98. 512 samples per pixel.
- dmc: 49 seconds to render
- gcc: 50
- ow: 55
- bc: 62
Machine: 1.4 ghz athlon 64, windows 98. 2048 samples per pixel.
- gcc: 21
- dmc: 30
- ow: 38
- bc: 43
Machine: 3.3 ghz haswell xeon, linux + wine. 4096 samples per pixel.
- gcc: 9
- dmc: 12
- ow: 20
- bc: 22
I ran each test twice, and the results were about the same every time. The render times are relative to the number of samples per pixels - the more samples, the slower it goes - so you can't directly compare the cpus.
It's worth noting that while dmc produced the second-fastest executable, it was also the only one to produce an artifact in the rendering, a white line at the top of the image. Shown here are the renderings at 2048 spp (bc, dmc, gcc, ow). I briefly debugged this by varying the compile options, including disabling optimizations, but no change. It may or may not be an fp issue.
