POV-Ray : Newsgroups : povray.general : Compiling with optimizations? : Re: Compiling with optimizations? Server Time
31 Jul 2024 14:25:38 EDT (-0400)
  Re: Compiling with optimizations?  
From: Warp
Date: 29 Dec 2006 08:14:07
Message: <4595149e@news.povray.org>
Nicolas George <nicolas$george@salle-s.org> wrote:
> - some use only generic features, but tune the code according to the
>   strengths and weaknesses of a given processor, and will result in binaries
>   that run on others processors, only slower than a binary with generic
>   optimizations.

  The most common tactic is indeed to instruct the compiler to optimize
for a certain processor (such as Pentium4) but using only opcodes of an
older processor (such as the 386). The result may not be the fastest
possible for that processor (eg. P4 in this case) because opcodes
specific to that processor are not used, but the difference is usually
not very large (you might get something like 10% or such speedup by
recompiling for P4 specifically, which is not really a whole lot). And
the binary will still work in a 386 if needed (even though it might not
be the most optimal for that processor either because the optimization
was made for the P4, not the 386).

  Perhaps a bit surprisingly, and a rather positive thing, it seems that
optimizing code for the P4 also makes the code faster in the AMD Athlon
and newer (even though not exactly as fast as an Athlon-specific
optimization, but not very far away either).

  Of course if you really want to get even the last bit of optimization,
you should download the source code distribution and compile it (the
current configure script tries to detect your hardware and tune the
optimizations for them, but you can of course also add your own optimization
flags to it). How much this will benefit will depend a lot on your system.

  Btw, there's an additional possible way of creating a binary: One which
actually has multiple binaries inside it, each optimized for a certain
processor. The binary will at runtime detect the type of processor and
run code optimized for it. I don't know if any binary distro of povray
uses this technique, though. (The Mac version might.)

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.