Changes

Jump to: navigation, search

Nasal Loops

312 bytes added, 04:10, 1 February 2014
http://forum.flightgear.org/viewtopic.php?f=4&t=20576&p=199262&hilit=#p199265
However, most Nasal code is not directly called via Nasal::update(), but instead via callbacks by other C++ subsystems, such as events (for timers) or the property tree code (for listeners), but also the AI traffic system, scenery system - or even the GUI system, whenever Nasal hooks are supported by the system, the corresponding system needs to reach back into Nasal space, which may end up triggering the GC.
regarding callbacks invoked via timers and listeners, I would also suggest to always maintain a counter to see how many instances of each loop are running - i.e. initialize the counter with 0, and then use +=1 and -=1 at the end of the callback.
 
you can then easily dump all counters to the console via print
In the meantime what you could do is keep taking things out until you find some things that slow FG down. Start with the 3D model (eg replace with UFO) then take out various parts of Nasal, particularly those that have timers, listeners, or other callbacks. From there you can narrow it down by checking individual call times via systime(), like my framework does (on a large scale), or maybe debug.benchmark when I provide a small patch...
 
 
== for, while, foreach, and forindex loops ==
Nasal's looping constructs are mostly C-like:
18,428
edits

Navigation menu