* Torsten Dreyer -- Wednesday 24 October 2007:
> > The Seneca is special in that it attaches listeners to YASim
> > internal properties, which are updated multiple times per
> > frame, unlike most other listeners, [...]

> Oh - wasn't it using JSBSim as fdm!?

Indeed. I remembered that wrongly because the Seneca doesn't
have a SenecaII-set.xml file, but only a SenecaII-jsbsim-set.xml,
which is usually only done when there are more choices. (I have
that shorter name as a line to the long one.)



> I [...] have removed most of the frequent-update listeners in 
> my local copy. 
[...]
> At least my listener-loaded-code was not *that* bad: 

True, kind-of. But the reason why I found evidence for a bug
in Nasal's garbage collector had nothing to do with the Seneca,
or claims that listeners are slow. This was just because I
worked on making FGBinding::fire() faster, as this was another
point on Durk's blacklist. I use the node refcounter for the
script cache's own garbage collector, so I printed it to the
console, and the steadily increasing counter for the throttle
binding property rang the alarm bell.  :-)

Although some of the listeners in the Seneca are used
inefficiently, they were mostly bad because of that GC bug.
Now that this is fixed, they are only unfortunate, but no
longer evil.

Listeners should be used on properties to get notice about
occasional changes. In cases where we *know* when the property
changes -- once per loop or more often -- we can have the same
result cheaper with a loop. (Listeners on YASim properties are
special in that those can change several times per frame, and
one may indeed want the listener triggered every time. But this
should be a deliberate decision, not an accident.)

For some of your listeners it may be enough to set the second
optional argument to 0, so that the listener code is only
triggered when the node value changes. Just turn on listener
logging or put a print() message into it to see the costs.

  $ fgfs --log-level=debug 2>&1|grep listener

m.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to