swordlegend / recastnavigation

Automatically exported from code.google.com/p/recastnavigation
zlib License
0 stars 0 forks source link

rcBuildContext performance tweak #111

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
As rcBuildContext is made up of a number of virtual functions this obviously 
has a performance overhead. It might be an idea to store flags in the base 
class to switch behaviour on/off. So, for example, I might do:

rcBuildContext myBuildContext;
myBuildContext.setFlag( RC_BUILD_COLLECTBUILDTIMES );
myBuildContext.unsetFlag( RC_BUILD_LOG );

rcRasterizeTriangles( &myBuildContext, ... );

...before calling any virtual functions, the Recast code could check if the 
flags are on/off.

As specified in another "issue", it might be a good idea to add memory 
management to this class - instead of having global function ptrs (which are 
not threadsafe).

Also, as all your functions insist on rcBuildContext being passed in, would it 
not make sense for it to be passed by reference? You could remove the asserts 
then. Or, allow it to be an optional param and remove the asserts. My 
preference is for pass-by-reference (especially if memory management becomes 
part of the class)

Original issue reported on code.google.com by armstron...@gmail.com on 23 Aug 2010 at 5:08

GoogleCodeExporter commented 9 years ago
Fixed in R206.

Original comment by memono...@gmail.com on 24 Aug 2010 at 6:00