On 21/06/2016 at 02:34, xxxxxxxx wrote:
Cinema 4D Version: R17
Platform: Windows ;
Language(s) : C++ ;
When I'm about to render in my engine, I have to parse the hierarchy and store some data in stacks.
I also need the object pointers to the original hierarchy nodes, so I use a BaseLinkArray as stack.
For each child in the hierarchy, I call Append (....) and after the child's children have been processed, I call Remove( GetCounter() - 1).
So, on hierarchy traversal, this data structure starts and ends with 0 objects and the number of appends is exactly the same with the number of removes.
The problem is that this data structure is very slow. In a scene with 10k nodes, the Append call takes 8 seconds (CPU i7-5820k).
Is there anything I can do to make BaseLinkArray work faster ? (Maybe preallocating the baselink memory? )
The other solution would be to create my own structure that handles BaseLink's memory more efficiently by allocating and deleting them all together.
Would that be faster ?