cpu usage increased with 2.73

pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

cpu usage increased with 2.73

Post by pico »

Hi Erwin,

after updating to 2.73 our games physics cpu usage has increased by factor 5x. Its due to the removal of getActiveObjects.
On a 3.2Gh Athlon having 10.000 static boxes already takes ~8000ms processing.

Will getActiveObjects be removed forever or re-enabled for 2.74 along with island improvements?
Its not clear to me from the Google Code info...

Thanks for any info
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: cpu usage increased with 2.73

Post by pico »

one note on this:
If getting 'active objects' is not reliable on runtime then maybe it would make sense to use at least two arrays for static and non static objects.

Those two arrays would not be needed to be changed at runtime, but only when objects are added or removed. This should make it 100% reliable and would make simulation faster for everyone.
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: cpu usage increased with 2.73

Post by pico »

Or does the new active island code solve the problem anyway?
mreuvers
Posts: 69
Joined: Sat May 10, 2008 8:39 am

Re: cpu usage increased with 2.73

Post by mreuvers »

Another slowdown thingy that I noticed in that latest trunk (we're at #1555), is that SOLVER_SIMD is switched on by default. For people using SIMD (Xbox, ps3 and windows) this is all good news. However it's also switched on for platforms that don't support SSE.

This 'feature' causes the btSequentialImpulseConstraintSolver to call the resolveSingleConstraintRowGenericSIMD and resolveSingleConstraintRowLowerLimitSIMD methods, which on their turn simply call the non-SIMD functions. This produces an extra function call in the inner-loop.

In my opinion the default should be non-SIMD and that the solved can only use the SOLVER_SIMD flag if and only if USE_SIMD is defined.

Somewhat unrelated, but I noticed SIMD_FORCE_INLINE pragmas in cpp files (simply do a global search and you will find them). As far as I know, not all compilers, if any at all, will inline code from cpp files, so this is a bit confusing ;-)
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: cpu usage increased with 2.73

Post by Erwin Coumans »

Bullet 2.73 should have better performance in most cases.
This produces an extra function call in the inner-loop.
This is likely negligible, and a proper optimizing compiler will remove the function call.
Somewhat unrelated, but I noticed SIMD_FORCE_INLINE pragmas in cpp files (simply do a global search and you will find them). As far as I know, not all compilers, if any at all, will inline code from cpp files, so this is a bit confusing
Yes, several compilers will optimize and inline the method if it is used in the same .cpp file. Even more interesting, a virtual method can be declared as 'inline' and if the type of the class is known at compile-time, it will be inlined.

Hope this helps,
Erwin
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: cpu usage increased with 2.73

Post by pico »

Hi Erwin,

do you think the new island improvements will cure the linear cpu usage increase with increasing number of collision objects?
What about the idea to have two lists with objects? One static object and one dynamic object list?