POV-Ray : Newsgroups : povray.programming : Re: Problem with f_rounded_box function Server Time
17 May 2024 06:38:08 EDT (-0400)
  Re: Problem with f_rounded_box function (Message 11 to 12 of 12)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Sebastian H 
Subject: Re: Problem with f_rounded_box function
Date: 15 Mar 2006 04:45:06
Message: <4417e222@news.povray.org>
Christoph Hormann wrote:
> 
> Well - the most important reason is to maintain the beauty of symmetry 
> in the code... ;-)

And the winning title is "A reflection of geometry in C"... :-)

I did some further investigation and compared four different
incarnations of f_rounded_box. The winner, at least on my pentium-m
machine, is version 5 (All versions are in the attachement).

For the comparison the (debian sarge) machine was switched into single
user mode and (hopefully) all unneccesary tasks were shut down. Then the
test scene (p.b.scene-files) were rendered 8 times each with no
jitter/AA at 8000x4500.
A plot of the render times is in p.b.images.

Astonishing is that version 5 is faster than version 8
although the latter one contains a simpler square root function.
Probably some compiler optimization (g++ (GCC) 3.3.5 (Debian 
1:3.3.5-13)) jumped in in version 5.

Regards,
Sebastian

P.S.: The second attachement contains the render times for the test
scene.


Post a reply to this message


Attachments:
Download 'us-ascii' (3 KB) Download 'times.dat.txt' (1 KB)

From: Christoph Hormann
Subject: Re: Problem with f_rounded_box function
Date: 15 Mar 2006 06:55:03
Message: <dv8v5p$mud$1@chho.imagico.de>
Sebastian H. wrote:
> [...]
> 
> Astonishing is that version 5 is faster than version 8
> although the latter one contains a simpler square root function.
> Probably some compiler optimization (g++ (GCC) 3.3.5 (Debian 
> 1:3.3.5-13)) jumped in in version 5.

But those differences are marginal - and it is very likely that 
interferences between code, compiler optimizations and processor design 
play a role here.  So there is no reason to select a certain code 
variant based on this.

But anyway this is a good demonstration that these days simple 
estimations of efficiency of code based on counting elementary 
operations is not working.

Christoph

-- 
POV-Ray tutorials, include files, Landscape of the week:
http://www.imagico.de/ (Last updated 14 Mar. 2006)
MegaPOV with mechanics simulation: http://megapov.inetart.net/


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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