Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Speeding up concurrent_hash_map by using multiple maps

Yumo_J_
Beginner
315 Views

Is it possible to speed-up concurrent_hash_map by using multiple concurrent_hash_maps which are bucketed by a primary hash.

We have around two million objects to store and 32 threads are accessing them. We created 64 concurrent_hash_maps and based on the key,  used one of the map to insert and lookup objects. We expected significant speed gain compared to using one map but the insert and lookup time remained pretty much the same. 

ObjectMaps[key&63]->insert(); 

ObjectMaps[key&63]->find(); 

Any insight will be appreciated

0 Kudos
2 Replies
Alexei_K_Intel
Employee
315 Views

In my opinion, external bucketing should not help significantly because tbb::concurrent_hash_map also uses the bucket-based approach internally. Therefore, tbb::concurrent_hash_map implements similar idea and external bucketing seems redundant. I am not sure that it is possible to speed it up easily without changing the algorithm.

Could you describe your algorithm that we can try to find another approach to optimize it? Have you tried Intel VTune Amplifier to find bottlenecks in your application?

0 Kudos
Yumo_J_
Beginner
315 Views

Alex, at this moment it's just a test program to compare TBB with our in house solution which we plan to replace using TBB.

Can you comment on algorithm complexity of TBB and how does the performance of TBB changes as number of object grows. Maybe that could a reason that second level of bucketing had no significant impact on performance.

0 Kudos
Reply