Hi Patrick,
wondering what you are up to...
> Now, what is faster and les expensive:
> Using a GLOBAL Var or a STATIC Var from with in a function.
>
> Function myVar(n)
> STATIC myVar:={1,2,3,4,5}
> RETURN myVar[n]
>From my understanding, GLOBAL, STATIC and LOCAL variables are lexical
variables. They are resolved at compile time. Accessing lexical variables is
faster than accessing dynamic memory variables like PRIVATE and PUBLIC.
Accessing lexical variables should be equally fast for GLOBAL, STATIC and
LOCAL. The difference between them is their visibility and lifetime. A
GLOBAL variable is less expensive than a STATIC variable accessed via a
function, since the function call (as in your example) can be omitted with
the GLOBAL variable.
The interesting question for me is: what is faster
1) 100 PUBLIC variables
2) One GLOBAL variable holding 100 key/value pairs
Regards,
--
Hannes
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
xHarbour-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xharbour-developers