Opened 12 years ago
Last modified 9 years ago
#4228 new Bugs
Associative containers performance
Reported by: | Domagoj Šarić | Owned by: | Joel de Guzman |
---|---|---|---|
Milestone: | Boost 1.43.0 | Component: | fusion |
Version: | Boost 1.44.0 | Severity: | Optimization |
Keywords: | Cc: |
Description
The Boost.Fusion documentation states that associative containers provide efficient key-based access while this seems not to be so in reality (AFAICT the associative containers actually use vectors for their implementation).
As reported in this post http://lists.boost.org/Archives/boost/2010/05/166358.php I have achieved meassurably better compile-time performance when using plain fusion::vectors with linear searches than with fusion::maps. Attached are two simple tests that try to demonstrate this (Steven Watanabe's template profiler 'says' that both approaches yield the same number of template instantiations).
The reason that in my real life (much more complicated) project I get not only same but better performance with vectors might perhaps be that the find<> (linear search) on the 'main vector' might already be 'cached'/instantiated by some other operation.
Attachments (2)
Change History (3)
by , 12 years ago
Attachment: | test_map.cpp added |
---|
by , 12 years ago
Attachment: | test_vector.cpp added |
---|
Have you tried the newer C++11 based implementation of fusion map?