POV-Ray : Newsgroups : povray.advanced-users : Function Evaluation Expense : Re: Function Evaluation Expense Server Time
8 Dec 2023 18:32:41 EST (-0500)
  Re: Function Evaluation Expense  
From: William F Pokorny
Date: 3 Feb 2023 15:14:46
Message: <63dd6b36$1@news.povray.org>
On 1/29/23 18:50, Bald Eagle wrote:
> W. F. Pokorny recently commented that floor () was "expensive"
> I wanted to get some idea of HOW expensive any given function was, in the grand
> scheme of things.

Interesting. Measuring the cost of functions in POV-Ray can be tricky. 
For starters, usage falls roughly into three buckets. Namely:

1) Pure SDL calls to SDL internally wrapped C++ functions.
2) Calls from SDL of the VM implemented forms of functions.
3) Calls to VM functions from parse time 'compiled' code.

One happens while parsing; Two usually while parsing, but sometimes 
while rendering; Three usually while rendering, but this can be a 'parse 
phase' thing too.

At the bottom, for standard math functions, one usually calls the C++ 
implementation inside the VM too. There is always a C++ pow() 
invocation, for example, but the POV-Ray calling path/method and wrapper 
code around pow() changes.

I expect you are measuring purely SDL parse time performance - (1) - 
without any attempt at removing the SDL looping cost ?

Bill P.

Aside 1 : Somewhere I posted a chart where I measured a few functions 
with respect to (1) and (3). I had plans for something more complete, 
but the work long stalled...

Aside 2 : The handling of function call exceptions is varied in the SDL 
and VM implementations. If invalid calls are made, the execution might 
or might not stop as viewed by the user. I 'suspect' non-stopping, 
invalid calls could significantly skew performance measurements - 
depending also on how POV-Ray was compiled.

Post a reply to this message

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