On 25.03.2011 02 <tel:25.03.2011%2002>:56, Robert wrote:
Yeah you are right. After removing every script from the global Nasal
folder, the events subsystem showed it spent 0 ms.
Copying the scripts back to that folder one by one increased the time
spent.
Indeed the jitter is caused by Nasal's "garbageCollect" method. Simple
test: add a printf (apply attached "patch" to simgear) and you should
see the "stutter" is synchronized with it.
Hmm...this problem seems to be unsolvable right now.
Well, there is a workaround! Use a faster CPU :). I see a jitter of
about 7ms with most aircraft.
However, the garbage collector does a complete scan of all Nasal objects
to detect and remove unreachable elements. So, the more Nasal data
elements we have, the worse the jitter gets. Large Nasal data structures
will eventually break every CPU. And since it's done in the context of
normal Nasal calls, and not in a separate background thread, it directly
affects the duration of our main update loop - hence frame rate. Not so
nice.
Hmm. Other script languages rely on reference counting for garbage
collection, which means much more stable performance. Python does that
for example. But, well... GSoC anyone? ;-)
cheers,
Thorsten
diff --git a/simgear/nasal/gc.c b/simgear/nasal/gc.c
index e9d9b7b..0926936 100644
--- a/simgear/nasal/gc.c
+++ b/simgear/nasal/gc.c
@@ -37,6 +37,8 @@ static void garbageCollect()
{
int i;
struct Context* c;
+ printf("Nasal garbage collector...\n");
+
globals->allocCount = 0;
c = globals->allContexts;
while(c) {
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel