POV-Ray : Newsgroups : povray.general : Parsing question... : Re: Parsing question... Server Time
5 Aug 2024 18:24:13 EDT (-0400)
  Re: Parsing question...  
From: Christopher James Huff
Date: 6 Aug 2002 20:07:41
Message: <chrishuff-558EB0.18574106082002@netplex.aussie.org>
In article <3d50350b$1@news.povray.org>,
 "Tim Nikias" <tim### [at] gmxde> wrote:

> What is actually easier for POV to parse,
> (Float_Value*2) or (Float_Value+Float_Value)?
> 
> Does it make a difference? I tend to recall that
> I've learned somewhere that any parser/CPU has
> to do some extra job to break down the "multiply with
> 2" into something it can actually calculate, while
> "add" is very simple and clean to do for a CPU.

The differences between CPU instructions are so little compared to the 
parser overhead that you probably couldn't even measure the difference, 
and modern processors are so much more complex that it isn't even worth 
thinking about, and modern compilers will automatically optimize many 
things...the multiply by 2 might end up faster than an add.
However, for POV: the first version has fewer characters, so the current 
parser would probably parse it a little more quickly. If used in a 
function, there would be no noticeable difference in how fast the 
function executed.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

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