CodeAndWeb / PhysicsEditor-Loaders

Use these classes to load the plist/xml file written by PhysicsEditor
39 stars 21 forks source link

Use std::unordered_map instead of std::map #11

Closed Rubonnek closed 5 years ago

Rubonnek commented 7 years ago

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.