[Bf-committers] Efficient generic data structures for Blender?

Christian Hubert christian.hubert at dstribe.com
Tue May 8 13:32:42 CEST 2018



I've not found generic (template) data structures in Blender code for now. I
mean some equivalent to std::xxx libs. Does that exist?


The point is the following:

*	std::map (and other) are bad in performance (probably because of
memory allocation)
*	Though, this kind of structure can be really useful to (more) easily
construct algorithms of various kind


What is your opinion about that? What I am thinking about is to code a
library which can be more efficient than sdtlib is, but I'll try to do it
only if Blender coders find a global interest for that.


Thanks for any feedback.



For information, what I've done so far is the following:

*	Compared performance of std::map vs. .Net dictionaries : .Net is
about 100x faster than std (the test populates the structure of 1000000
integers ; 50ms for .Net vs. 5s for std, both in debug mode)
*	Looked at the source code of the .Net library (it is optimized
concerning memory allocation, using prime numbers steps for that)
*	Coded an equivalent in C++, which now works for dictionary<int,
int>: the perf is the same as the native .Net
*	To do: need more work as it is bugged for more complex things (as
dictionary<int, dictionary<int, bool>> crashes in my actual code due to
memory conflicts)



More information about the Bf-committers mailing list