POV-Ray : Newsgroups : povray.advanced-users : Function Evaluation Expense : Function Evaluation Expense Server Time
8 Dec 2023 16:54:21 EST (-0500)
  Function Evaluation Expense  
From: Bald Eagle
Date: 29 Jan 2023 18:55:00
Message: <web.63d7062bbfd52c3a1f9dae3025979125@news.povray.org>
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.

My code is real crap, since I had multiple functions, taking different numbers
of arguments, and being evaluated over different ranges, so I just whanged it
together in order to get SOME kind of result in a reasonable amount of time.
I'm sure this sort of thing could be massively improved, and I'd learn a lot
about both the functions and how to write code for such a project MUCH more

It's clear to me that some functions take monger to evaluate depending upon what
input you feed them.  Tanh() goes from "comparable to most other functions" to
over 100,000 times the cost of everything else.

I'm also interested in redoing sqrt, mod, pow, and iterative multiplication.  I
also completely neglected division.

Anyway, here are all the functions that I tested, with tanh() scaled WAY down so
that the relative costs of all the other functions is a bit clearer.

Each function is evaluated 100,000 times.

Post a reply to this message

Download 'functiontimer.png' (121 KB)

Preview of image 'functiontimer.png'


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