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)

test_map.cpp (1.5 KB ) - added by Domagoj Šarić 12 years ago.
test_vector.cpp (1.7 KB ) - added by Domagoj Šarić 12 years ago.

Download all attachments as: .zip

Change History (3)

by Domagoj Šarić, 12 years ago

Attachment: test_map.cpp added

by Domagoj Šarić, 12 years ago

Attachment: test_vector.cpp added

comment:1 by Joel de Guzman, 9 years ago

Have you tried the newer C++11 based implementation of fusion map?

Note: See TracTickets for help on using tickets.