POV-Ray : Newsgroups : povray.programming : Surprising change in speed of comparison operators : Surprising change in speed of comparison operators Server Time
11 Oct 2024 14:57:01 EDT (-0400)
  Surprising change in speed of comparison operators  
From: Bald Eagle
Date: 1 May 2024 21:40:00
Message: <web.6632eeb5bd7d62531f9dae3025979125@news.povray.org>
I'm currently testing a hierarchical method of maze-solving to simulate 1-way
doors, and I've made some very small changes which have resulted in a massive
slowdown - probably 1/8 to 1/10 the original speed.  :O

All I've done is replace 5 lines where comparisons using = now use a <= or a >.
The first slowdown was noticed by changing a single line from
#if (walkability [a][b] != unwalkable)
to
#if (walkability [a][b] <= Threshold)

Also, there is one extra test block that got added:
#if (walkability [a][b] = exited)
    #declare Threshold = 5;
#end
{switches 1-way doors from a walkable path to an obstacle}

Has anyone experienced this sort of thing before?

Are there faster ways to do this sort of thing?
Using a ternary operator to assign a value rather than #if block?
Using a function rather than an inline equation?

I'm probably going to have to run my old function time-comparison scene file to
perform these types of methods 100,000 times and see if there's a massive
slowdown between = and >.

Really any suggestions are welcome.   This is now going WAY too slow.


Post a reply to this message

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