I inspected the code again and I think it's better to use std::unordered_map for bodyDefs and bodiesInFile instead since std::unordered_map is a faster container for accessing individual elements.
The only time the code loops over bodyDefs is for removing all the shapes, which is where we are shifting the performance hit to since the std::unordered_map container is slower in that case.
I'd rather have faster object creation by using std::unordered_map than faster object removal by using std::map.
I inspected the code again and I think it's better to use
std::unordered_map
forbodyDefs
andbodiesInFile
instead sincestd::unordered_map
is a faster container for accessing individual elements.The only time the code loops over
bodyDefs
is for removing all the shapes, which is where we are shifting the performance hit to since thestd::unordered_map
container is slower in that case.I'd rather have faster object creation by using
std::unordered_map
than faster object removal by usingstd::map
.