Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
Use unordered_set for slightly better performance.
Browse files Browse the repository at this point in the history
  • Loading branch information
erikogenvik committed Jul 16, 2020
1 parent 70b50cd commit 53aa448
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/rules/simulation/PhysicalDomain.cpp
Expand Up @@ -640,7 +640,7 @@ std::list<LocatedEntity*> PhysicalDomain::getObservingEntitiesFor(const LocatedE
class PhysicalDomain::VisibilityCallback : public btCollisionWorld::ContactResultCallback
{
public:
std::set<BulletEntry*> m_entries;
std::unordered_set<BulletEntry*> m_entries;

btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObjectWrapper* colObj0Wrap, int partId0, int index0, const btCollisionObjectWrapper* colObj1Wrap,
int partId1, int index1) override
Expand Down
5 changes: 3 additions & 2 deletions src/rules/simulation/PhysicalDomain.h
Expand Up @@ -31,6 +31,7 @@
#include <tuple>
#include <array>
#include <set>
#include <unordered_set>
#include <BulletCollision/CollisionDispatch/btGhostObject.h>

namespace Mercator {
Expand Down Expand Up @@ -130,11 +131,11 @@ class PhysicalDomain : public Domain
/**
* Set of entries which are observing by this.
*/
std::set<BulletEntry*> observedByThis;
std::unordered_set<BulletEntry*> observedByThis;
/**
* Set of entries which are observing this.
*/
std::set<BulletEntry*> observingThis;
std::unordered_set<BulletEntry*> observingThis;

btVector3 centerOfMassOffset;

Expand Down

0 comments on commit 53aa448

Please sign in to comment.