Bad perfomance

whiplash
Posts: 16
Joined: Sun Dec 13, 2009 3:21 pm

Bad perfomance

Post by whiplash »

Hello!

I have a question about better perfomance of Bullet. My simple scene (i use Ogre):
1) static plane - btStaticPlaneShape;
2) one static building (consist is five inner rooms) - btTriangleMesh -> btBvhTriangleMeshShape;
3) one dynamic (moving manually "character") object - btMultiSphereShape (one element).

If i moving dynamic character near outer wall of room - i have 120 fps. But if i moving character to room (near inner wall of room) - fps down to 20-30 fps. Why? Building have not many polygons - 400/500.

Whether there is other path of increase in perfomance, except approximating to a box/sphere/...?
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Bad perfomance

Post by Dirk Gregorius »

You can use Bullet's internal profiler to dump all samples. Maybe just dump at the two scenarios and post the results here. I am sure Erwin can help you to isolate the bottleneck.
whiplash
Posts: 16
Joined: Sun Dec 13, 2009 3:21 pm

Re: Bad perfomance

Post by whiplash »

Profiler log:

Code: Select all

Profiling: Root (total running time: 351.813 ms) ---
0 -- stepSimulation (99.99 %) :: 351.768 ms / frame (1 calls)
Unaccounted: (0.013 %) :: 0.045 ms
...----------------------------------
...Profiling: stepSimulation (total running time: 351.768 ms) ---
...0 -- synchronizeMotionStates (0.06 %) :: 0.196 ms / frame (10 calls)
...1 -- internalSingleStepSimulation (99.93 %) :: 351.516 ms / frame (10 calls)
...Unaccounted: (0.016 %) :: 0.056 ms
......----------------------------------
......Profiling: internalSingleStepSimulation (total running time: 351.516 ms) ---
......0 -- updateActivationState (0.01 %) :: 0.034 ms / frame (10 calls)
......1 -- updateActions (0.01 %) :: 0.018 ms / frame (10 calls)
......2 -- integrateTransforms (0.09 %) :: 0.333 ms / frame (10 calls)
......3 -- solveConstraints (3.71 %) :: 13.058 ms / frame (10 calls)
......4 -- calculateSimulationIslands (0.03 %) :: 0.121 ms / frame (10 calls)
......5 -- performDiscreteCollisionDetection (95.86 %) :: 336.951 ms / frame (10 calls)
......6 -- predictUnconstraintMotion (0.23 %) :: 0.802 ms / frame (10 calls)
......Unaccounted: (0.057 %) :: 0.199 ms
.........----------------------------------
.........Profiling: solveConstraints (total running time: 13.058 ms) ---
.........0 -- solveGroup (91.41 %) :: 11.936 ms / frame (10 calls)
.........1 -- processIslands (5.02 %) :: 0.656 ms / frame (10 calls)
.........2 -- islandUnionFindAndQuickSort (1.24 %) :: 0.162 ms / frame (10 calls)
.........Unaccounted: (2.328 %) :: 0.304 ms
............----------------------------------
............Profiling: solveGroup (total running time: 11.936 ms) ---
............0 -- solveGroupCacheFriendlyIterations (50.43 %) :: 6.019 ms / frame (10 calls)
............1 -- solveGroupCacheFriendlySetup (48.40 %) :: 5.777 ms / frame (10 calls)
............Unaccounted: (1.173 %) :: 0.140 ms
.........----------------------------------
.........Profiling: performDiscreteCollisionDetection (total running time: 336.951 ms) ---
.........0 -- dispatchAllCollisionPairs (99.88 %) :: 336.539 ms / frame (10 calls)
.........1 -- calculateOverlappingPairs (0.01 %) :: 0.029 ms / frame (10 calls)
.........2 -- updateAabbs (0.09 %) :: 0.296 ms / frame (10 calls)
.........Unaccounted: (0.026 %) :: 0.087 ms
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Bad perfomance

Post by Dirk Gregorius »

Are you using a release build?
whiplash
Posts: 16
Joined: Sun Dec 13, 2009 3:21 pm

Re: Bad perfomance

Post by whiplash »

No, i using debug build. But release build not better:

Code: Select all

Profiling: Root (total running time: 347.264 ms) ---
0 -- stepSimulation (99.99 %) :: 347.217 ms / frame (1 calls)
Unaccounted: (0.014 %) :: 0.047 ms
...----------------------------------
...Profiling: stepSimulation (total running time: 347.217 ms) ---
...0 -- synchronizeMotionStates (0.06 %) :: 0.200 ms / frame (10 calls)
...1 -- internalSingleStepSimulation (99.93 %) :: 346.966 ms / frame (10 calls)
...Unaccounted: (0.015 %) :: 0.051 ms
......----------------------------------
......Profiling: internalSingleStepSimulation (total running time: 346.966 ms) ---
......0 -- updateActivationState (0.01 %) :: 0.034 ms / frame (10 calls)
......1 -- updateActions (0.00 %) :: 0.017 ms / frame (10 calls)
......2 -- integrateTransforms (0.11 %) :: 0.369 ms / frame (10 calls)
......3 -- solveConstraints (3.49 %) :: 12.124 ms / frame (10 calls)
......4 -- calculateSimulationIslands (0.03 %) :: 0.119 ms / frame (10 calls)
......5 -- performDiscreteCollisionDetection (96.25 %) :: 333.941 ms / frame (10 calls)
......6 -- predictUnconstraintMotion (0.05 %) :: 0.167 ms / frame (10 calls)
......Unaccounted: (0.056 %) :: 0.195 ms
.........----------------------------------
.........Profiling: solveConstraints (total running time: 12.124 ms) ---
.........0 -- solveGroup (90.45 %) :: 10.966 ms / frame (10 calls)
.........1 -- processIslands (5.94 %) :: 0.720 ms / frame (10 calls)
.........2 -- islandUnionFindAndQuickSort (1.34 %) :: 0.162 ms / frame (10 calls)
.........Unaccounted: (2.276 %) :: 0.276 ms
............----------------------------------
............Profiling: solveGroup (total running time: 10.966 ms) ---
............0 -- solveGroupCacheFriendlyIterations (46.25 %) :: 5.072 ms / frame (10 calls)
............1 -- solveGroupCacheFriendlySetup (52.54 %) :: 5.762 ms / frame (10 calls)
............Unaccounted: (1.204 %) :: 0.132 ms
.........----------------------------------
.........Profiling: performDiscreteCollisionDetection (total running time: 333.941 ms) ---
.........0 -- dispatchAllCollisionPairs (99.89 %) :: 333.572 ms / frame (10 calls)
.........1 -- calculateOverlappingPairs (0.01 %) :: 0.026 ms / frame (10 calls)
.........2 -- updateAabbs (0.08 %) :: 0.259 ms / frame (10 calls)
.........Unaccounted: (0.025 %) :: 0.084 ms
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Bad perfomance

Post by Dirk Gregorius »

You should not profile debug builds! :)

This doesn't make sense! Are you sure you are linking the release build of Bullet. It is not enough to simply change the build type in your application.

HTH,
-Dirk
whiplash
Posts: 16
Joined: Sun Dec 13, 2009 3:21 pm

Re: Bad perfomance

Post by whiplash »

I use preprocessor's commands:

Code: Select all

#ifdef _DEBUG
	#pragma comment(lib, "bulletdynamics_d.lib")
	#pragma comment(lib, "bulletcollision_d.lib")
	#pragma comment(lib, "linearmath_d.lib")
#else
	#pragma comment(lib, "bulletdynamics.lib")
	#pragma comment(lib, "bulletcollision.lib")
	#pragma comment(lib, "linearmath.lib")
#endif
(*.lib in catalogs "...\lib\Debug" and "...\lib\Release")

My link aren't correct?