BGE performance: second round of scenegraph improvement.
authorBenoit Bolsee <benoit.bolsee@online.be>
Sun, 3 May 2009 22:29:00 +0000 (22:29 +0000)
committerBenoit Bolsee <benoit.bolsee@online.be>
Sun, 3 May 2009 22:29:00 +0000 (22:29 +0000)
commit3abb8e8e68c824db7cecdf2360e8e1daaff00413
tree8f4fea6f267ce2d268cb82e9121c5208eeea8d8a
parent2aa3c932d00977a70bc299bd709fa505c48518d8
BGE performance: second round of scenegraph improvement.

Use dynamic linked list to handle scenegraph rather than dumb scan
of the whole tree. The performance improvement depends on the fraction
of moving objects. If most objects are static, the speed up is
considerable. The following table compares the time spent on
scenegraph before and after this commit on a scene with 10000 objects
in various configuratons:

Scenegraph time (ms)              Before         After
(includes culling)

All objects static,               8.8            1.7
all visible but small fraction
in the view frustrum

All objects static,               7,5            0.01
all invisible.

All objects moving,               14.1           8.4
all visible but small fraction
in the view frustrum

This tables shows that static and invisible objects take no CPU at all
for scenegraph and culling. In the general case, this commit will
speed up the scenegraph between 2x and 5x. Compared to 2.48a, it should
be between 4x and 10x faster. Further speed up is possible by making
the scenegraph cache-friendly.

Next round of performance improvement will be on the rasterizer: use
the same dynamic linked list technique for the mesh slots.
14 files changed:
projectfiles_vc9/gameengine/scenegraph/SG_SceneGraph.vcproj
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp
source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp
source/gameengine/Ketsji/KX_Scene.cpp
source/gameengine/Ketsji/KX_Scene.h
source/gameengine/SceneGraph/SG_DList.h [new file with mode: 0644]
source/gameengine/SceneGraph/SG_IObject.cpp
source/gameengine/SceneGraph/SG_IObject.h
source/gameengine/SceneGraph/SG_Node.cpp
source/gameengine/SceneGraph/SG_Node.h
source/gameengine/SceneGraph/SG_QList.h [new file with mode: 0644]
source/gameengine/SceneGraph/SG_Spatial.cpp
source/gameengine/SceneGraph/SG_Spatial.h