5H1N0B11 / flightgear-mirage2000

GNU General Public License v3.0
20 stars 15 forks source link

FPS are too low #138

Open 5H1N0B11 opened 3 years ago

5H1N0B11 commented 3 years ago

The FPS are really low for the mirage in comparison of other aircraft. We should find how to improve that.

hardba11 commented 3 years ago

how to find the cause of low fps ?

disable some stuf and see

1/ we could try to disable nasal scripts and check if FPS are better. On brsq, I noticed, aar nasal script could sometimes create an overload. maybe radar, shake effects, light effects, multiplay or backseat scripts could create an overload. It can be not so easy if the 2000 need nasal loaded to start engines, takeoff or something else

2/ we could start sim without loading model to check if there are too much polygons

eatdust commented 3 years ago

Yep, running 10-15fps on a GTX1080...

Could it be the extensive use of setprop()?

 grep -r setprop * | wc -l

returns more than 650 calls to setprop() and almost 700 for getprop().

Some quote from Stuart on the FG mailing list:

Stuart:

if you are just going to set a property once, then setprop() is faster than
globals.props.getNode("/property/path").setValue("something");

However, if you already have the node stored:

var n= globals.getNode("/property/path"); 

.... then n.setValue("something") is faster than setprop().

I don't know how many writes you need to do to make the overhead of 
globals.props.getNode("/property/path") to be worthwhile, but my recommendation
for any performance-oriented Nasal would be to call them all at the start of the day

I do see tens of successive call to set prop on a node, so, maybe there is some way to get fps there?

AxelPaccalin commented 3 years ago

This is one of the few major uptime of the scripts, true. But another thing is the canvas & MFD's, there is also some values that are computed quite a few times (in the radar / weapons code)... As you can see, the slowness is not really due to a single thing, but interactions with the property-tree is a big part indeed.

Zaretto commented 3 years ago

I added a lot of information to Issue #141 about how to optimise and I also wrote an article on the Wiki http://wiki.flightgear.org/Nasal_Optimisation