Rendering takes a lot of time, so it is clear that you want to optimize the raytracer. As the official POVRay binaries for linux are compiled using GCC with little (or none?!) special optimization options, there is some room for improvement (expect at least 20%).
There are some GCC options which might be interesting. Please check
their exact meaning in the docu (I mean the info pages, use
info gcc to see them) and try out which ones produce the
First, I recommend passing -pipe to gcc to use pipes
instead of temporary files.
Try a combination of the following general optimization flags:
Also, use appropriate machine/architecture-specific settings, for i386
platform have a look at:
More voodoo can be played with the following but I recommend not to touch
You can also try the feedback optimizer which requires actually running
the program between the two compilation passes:
Some curious people may try -fmem-report -ftime-report -Q and other options on the same info page.
I currently use these gcc flags when compiling POVRay:
make CXXFLAGS="-W -Wall -O2 -ffast-math -march=athlon-xp -Wno-multichar -finline-functions -funit-at-a-time -fno-rtti -fno-exceptions -fmessage-length=$COLUMNS -I/usr/local/numerics/include/"
Alternatively, for povray-3.6, one can specify the options at configure time and then get away with a plain make for the build.
../povray-3.6/configure --without-svga COMPILED_BY="fill in here" \ CFLAGS="-W -Wall -O2 -ffast-math -march=athlon-xp -Wno-multichar \ -finline-functions -funit-at-a-time" CXXFLAGS="-W -Wall -O2 -ffast-math -march=athlon-xp -Wno-multichar \ -finline-functions -funit-at-a-time -fno-rtti"
These flags are neither guaranteed to produce especially fast nor espcially small code, it's just what I am using...
Using some alternative to GCC
Especially when using the Intel Pentium4 processor, you can get even better results using Intel's C++ compiler for Linux. It is available for free for non-commercial use (but a quite big download, expect >60Mb). Unfortunately, the option syntax of GCC and ICC (Intel's C++ compiler) are still not fully compatible, so simply running make probably won't do the trick. Just pass all source files at once to icc, enable inter-object optimizations, check how to use the profiler and wait... (for compilation to complete).