

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
efficiently.
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
Attachments:
Download 'functiontimer.png' (121 KB)
Preview of image 'functiontimer.png'

