> And since something like "don't complain, just do it" was mentioned:
> I'm not complaining (my new machine is doing fine for now). I've just
> analyzed it and mention the facts.

Yes, actually your post is quite the opposite of complaining - it's very
informative and constructive in that it suggests how to improve things.

So, if I may ask a few question if I understand it correctly:

> 1. The length of the delay depends on the number of references the
> garbage collector needs to traverse: variables (data), but also
> functions, which are just like variables in Nasal, e.g.
>   var myVariable = 42;
>   var myFunction = func()...
> It doesn't depend on the size of a particular function or basic
> variable though.

To put a bit simplistic, it counts how often I used 'var' in the code.

That seems to make a case for somewhat ugly coding style, in that

for (var i =0; i< 30; i=i+1) # number of objects is 30
{
compute_stuff(getprop("some-property"),i);
}

is superior to

var number_of_objects = 30;

for (var i = 0; i < number_of_objects; i = i+1)
{
var some_property = getprop("some-property");
compute_stuff(some_property,i);
}

since the latter bit of code uses two more variables. (I'm tempted to say
'told you so' to a certain person...). Also I guess more dangerous things
like replacing local loop variables by a few global ones (provided you
don't run into nested loops...) would theoretically help then?

How do arrays and objects count? If an object counts as one reference,
then it's very efficient to use I guess - if every key in the hash counts
as one, then certainly less so.

> 2) The g/c frequency mainly depends on how much stuff is done in
> Nasal, including the number of timers and the timer frequencies.

I understand the basic principle 'if you don't need it, don't run the
loop, if you don't need it every frame, then don't run it every frame'.
But I'm not sure just how the load is generated.

Can loops pile up garbage checks only for elements referenced
(theoretically) within the loop (regardless if they are actually
executed), or do they trigger the whole possible pile of Nasal to be
searched? So if someone fixes a badly written script which runs every
frame although it really doesn't need to - will that affect the load
generated by that particular script, or will it have a more general
effect?

Thanks,

* Thorsten


------------------------------------------------------------------------------
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

Reply via email to