On Sunday 30 September 2007 17:14, Melchior FRANZ wrote: > * Durk Talsma -- Sunday 30 September 2007: > > Thirdly, there is a relation between execution time and listeners, > > Err ... Nasal listeners trigger Nasal code when the listened-to property > is written to. Executed code costs cpu cycles. Anyone surprised? >
Although most people will have a global idea as to what listeners are, I don't think that *that* many people are aware of the fact that the actual setValue function is the very same code that calls these Nasal functions. If you are not aware of this, it can be very puzzling why a seemingly simple function can take so long to execute. That was actually the triggering question for my little experiment, and this statement. On Sunday 30 September 2007 17:33, Melchior FRANZ wrote: > * Melchior FRANZ -- Sunday 30 September 2007: > > If listeners are used badly and trigger bad code, then this will, of > > course, hurt the framerate. But that's not because listeners are bad. > > I have to add, though, that the listener code in hsi.nas doesn't look > particularly slow, so it shouldn't cause any problems. I checked if > the properties that it writes to have listeners attached themselves, > but that's not the case. There must be some other cause. > /me scratching head > I'm still hoping that there is a common root cause for all this. I'm currenty investigating on the basis of a working theory that memory management is somehow involved. Yesterday, I noted that a simple "new FGReplay" statement was also showing intermittently long execution times, which seemed to grow over time. I didn't make plots, like I did for the joystick fire code, but will try to do that in a minute. If we see similar increases in execution time in a function like that, we know for sure it can't just be a single badly written piece of code. I actually wish it was that simple, so I could stop watching my hair turn grey. :-) Cheers, Durk ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel