In btDbvtBroadphase, why is deferred collide not on by default?
Posted: Thu Jan 10, 2019 10:05 pm
Recently I was pushing bullets btDbvtBroadphase more than I normally do, in particular I was using it to drive a particle system.
It would spawn a few thousands small dynamics near each other, they would only live a few seconds, then die, and more would be constantly spawning in.
btDbvtBroadphase started to become a significant bottleneck, specifically setAabb, which is called for anything that is active during each physics step.
setAabb cumulatively would take upwards of 5-7 ms, mostly spent in collideTTpersistentStack.
I noticed the btDbvtBroadphase ::m_deferedcollide variable that was set to false, when it is false, is performs immediate collides for whatever node was reinserted, this seems to generate lots of needless work--
By changing it to true, the collideTTpersistentStack calls are now deferred until btDbvtBroadphase::collide() is invoked.
And instead of performing the collide tests over and over, it compares the static and dynamic trees against each other once.
This dropped broadphase time significant, the total time for setAabb + collide is generally around 1.5 ms now(most of it spend in btDbvt::update which removes and re-adds the leafs)
Is there a reason deferred is not the default ?
Well I might create a pull request and see if Erwin rejects--
It would spawn a few thousands small dynamics near each other, they would only live a few seconds, then die, and more would be constantly spawning in.
btDbvtBroadphase started to become a significant bottleneck, specifically setAabb, which is called for anything that is active during each physics step.
setAabb cumulatively would take upwards of 5-7 ms, mostly spent in collideTTpersistentStack.
I noticed the btDbvtBroadphase ::m_deferedcollide variable that was set to false, when it is false, is performs immediate collides for whatever node was reinserted, this seems to generate lots of needless work--
By changing it to true, the collideTTpersistentStack calls are now deferred until btDbvtBroadphase::collide() is invoked.
And instead of performing the collide tests over and over, it compares the static and dynamic trees against each other once.
This dropped broadphase time significant, the total time for setAabb + collide is generally around 1.5 ms now(most of it spend in btDbvt::update which removes and re-adds the leafs)
Is there a reason deferred is not the default ?
Well I might create a pull request and see if Erwin rejects--