thorsten.i.r...@jyu.fi wrote: > 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. > After thinking about it I think that in the second case the property tree is being walked trough by the C++ code while in the first case it's done in Nasal. You just discovered that Nasal is 10x slower than C++ code! This is exactly why I prefer core code to end up in C++ in the end.
That said, Nasal performance tests are always useful. Erik ------------------------------------------------------------------------------ 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