supertuxkart / stk-code

The code base of supertuxkart
Other
4.45k stars 1.05k forks source link

SuperTuxKart is slow with 10000 invisible object #3780

Open MatthewsSam opened 5 years ago

MatthewsSam commented 5 years ago

If we load 10 000 invisible objects in SuperTuxKart it will render the scene at 30 FPS (while it's 100 if there are no objects).

It's ridiculous to go down to 30 FPS for only 10 000 objects which are not even displayed.

After quick investigation it might be because currently ISceneNode uses CORE::LIST which is a linked list. Linked list are slow for quick iteration needed by the scene manager for the rendering.

auriamg commented 5 years ago

After some tests, while the use of a linked list is a bit unexpected, that doesn't seem to be the root cause of the slowdown.

auriamg commented 5 years ago

LODNode::OnAnimate appears to be a major source of slowdowns, I get a 15 FPS gain if I remove it.

... and if I totally remove all calls to OnAnimate, I gain another 15 FPS (total 30 FPS gained by removing those calls!)

MatthewsSam commented 5 years ago

So after some tests with a profiler:

auriamg commented 5 years ago

Early prototype of possible improvement pushed to branch "3780-scene-optimisation"

MatthewsSam commented 5 years ago

So after trying your branch + auto LoD on amazon the track Black Forest I got: 75 FPS with the current master 85 FPS with the prototype branch 91 FPS with auto LoD

Benau commented 2 years ago

according to https://github.com/supertuxkart/stk-code/issues/3805#issuecomment-1228006247 it should be faster now

Alayan-stk-2 commented 4 months ago

Testing the Lodtest track while making everything invisible by returning automatically "-1" (don't display) when checking the LoD level.

Compiled in STKRelease mode, using OpenGL.

1.0 : ~100FPS Master with the invisible objects : ~230FPS Master with the objects removed through the "very low" setting : ~750FPS

While there is a very clear improvement, the perf cost of invisible objects is still way too high.