Nasal Loops: Difference between revisions

Jump to navigation Jump to search
forum2wiki
m (http://forum.flightgear.org/viewtopic.php?f=30&t=21886&p=198656&hilit=file+nasal+timers#p198644)
(forum2wiki)
Line 33: Line 33:
* However, they are run at the end (IIRC) of the frame, so if you need instant reaction (i.e. interaction back and forth with another subsystem via properties), loops won't be quick enough, and thus listeners would be required.
* However, they are run at the end (IIRC) of the frame, so if you need instant reaction (i.e. interaction back and forth with another subsystem via properties), loops won't be quick enough, and thus listeners would be required.


To optimize things in Nasal space, you need to understand where things really ARE slow - for starters, you can use "debug.benchmark()" for this - which is wrapper for two systime() calls to capture the overhead of the callback.
Philosopher has some more sophisticated stuff doing this sort of thing, but it's more difficult to set up and not yet ready for "prime-time" - overall, discussions like these make it obvious that we could greatly benefit from having support for runtime benchmarking/profiling and debugging of Nasal code running within the FG main loop.
Given Philosopher's progress in 2013, I think we're at least half-way there already - but it's not a trivial problem, and it needs still some more work.
We're hoping to look into this again this year - anybody interested in helping with this, should check out Philosopher's "Nasal internals" document in $FG_ROOT/Docs


== for, while, foreach, and forindex loops ==
== for, while, foreach, and forindex loops ==

Navigation menu