I've just spent a session optimizing performance of the weather dynamics
routines, and I have largely done so by analyzing the performance of
elementary Nasal function calls and making use of my findings (and also by
dispensing with the pretense of elegant coding).

I was rather gratified to see the framerate improve significantly - a test
configuration which used to render at ~20 fps is now blasting away at ~60
fps. Given that I achieve only ~75 fps for the same cloud configuration if
I don't move any clouds, that's probably quite good already. In practical
terms, I usually get now above a comfortable  30 fps with the F-14b in a
drifting noon population of Cumulus clouds.

This almost miraculous increase was to a good part achieved by
consistently banning any use of the props or geo classes from
performance-critical code. To give an example - it turns out that while

node = props.globals.getNode("test",1);
for (var i = 0; i < n; i = i +
1){node.getChild("array",i,1).getNode("test",1).setValue(value);}

is an elegant structure to initialize or write an array of properties in
the tree, the ugly variant

for (var i = 0; i < n; i = i + 1){setprop("test/array["~i~"]/test", value);}

is ten (!) times faster. Basically, replacing an instance of a props
method with getprop() or setprop() seems to give at least a factor 2 in
speed, often more.

Similar with geo distance calculation methods.

Maybe you already know all of this. In case you don't and you're running
Nasal on a per frame basis anywhere, you may want to have a look into the
details of the tests.

http://www.flightgear.org/forums/viewtopic.php?f=30&t=9493
http://www.flightgear.org/forums/viewtopic.php?f=30&t=9495

Cheers,

* Thorsten


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to