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

Dahlia Trimble dahliatrimble at gmail.com
Fri May 11 05:01:57 CEST 2018


STL is incredibly slow in debug mode using Microsoft compilers. There's a
lot of additional code in there for boundary checks and to facilitate
debugging. You should try your comparison benchmarks in release mode.

On Tue, May 8, 2018 at 4:32 AM, Christian Hubert <
christian.hubert at dstribe.com> wrote:

> Hi,
>
>
>
> 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)
>
>
>
>
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> https://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list