POV-Ray : Newsgroups : povray.beta-test.binaries : Function / pattern issues. New inbuilt f_agate(). : Re: Function / pattern issues. New inbuilt f_agate(). Server Time
29 Apr 2024 12:14:02 EDT (-0400)
  Re: Function / pattern issues. New inbuilt f_agate().  
From: William F Pokorny
Date: 5 Jun 2020 06:43:03
Message: <5eda21b7$1@news.povray.org>
On 6/4/20 5:06 PM, Thorsten Froehlich wrote:
> William F Pokorny <ano### [at] anonymousorg> wrote:
...
>>
>> A significant part of the performance degrade in the normal agate
>> pattern looks to be due the use of a dynamic_cast(1) while it checks
>> which turbulence warp exists / is the internal agate one. So, other
>> special turbulence patterns likely have this slow down too - though I've
>> not tested them.
> 
> You mean this train wreck of a C++ function that is abusing dynamic cast for a
> type check?
> 
> bool AgatePattern::Precompute()
> {
>      return (!warps.empty() && dynamic_cast<ClassicTurbulence*>(*warps.begin()));
> }
> 
...
Similar. For agate most of the impact looks to me to be from:

static inline const ClassicTurbulence *GetTurb(const WarpList warps)
{
     POV_PATTERN_ASSERT(!warps.empty());
     POV_PATTERN_ASSERT(dynamic_cast<const 
ClassicTurbulence*>(*warps.begin()));
     return static_cast<const ClassicTurbulence*>(*warps.begin());
}

as it gets called - or probably 'run' as it's inlined - each time the 
agate pattern is evaluated at a point.

After a couple times finding dynamic_cast to be big performance hits, 
Christoph took a pass removing them from the ray tracing paths, leaving 
the majority of uses in the parsing code. But, some still exist in other 
than the parser. In the csg code there is still a cluster of them as I 
recall.

Bill P.


Post a reply to this message

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