Patrick,

GLOBAL var has similiar speed to STATIC var, then if you have any extra code to access to var that code is slower.

GLOBAL var is faster and les expensieve than access to STATIC Var with a function.

Walter Negro


Patrick Mast, xHarbour. escribió:
Hey Walter,

Thanks for the explanation.

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]

Patrick

On Sun, Nov 16, 2008 at 11:59 AM, Walter Negro <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Patrick

    Patrick Mast, xHarbour. escribió:

        Hi,

        In the "old" Clipper days we where told to NOT overuse PUBLIC
        or PRIVATE variables because they consume lots of memory and
        are slow. How is this in xHarbour? Is this still true?

    The PUBLIC and PRIVATE vars share space in the symbol table. The
    max size in Clipper for this table is 64k, but in xHarbour the
    limit is 2Gb, then we can use PUBLIC and PRIVATE vars without
    problem.


        And, is a PUBLIC var more 'expensieve' than a PRIVATE var?

    No. PRIVATE var is more "expensive" than PUBLIC, not in access but
    in creation and destruction.
    The PUBLIC vars are created once, but PRIVATE vars are created in
    each function.
    The PRIVATE vars need to be cleaned at the end of function.



        Is it less 'expensive;' to have ONE public var with an array
        of lets say 100 elements or 100 separate public var's?

    Access to array is more "expensive" than access to PUBLIC or
    PRIVATE var.
    Access to PUBLIC var use two PCODE.
    Access to array in PUBLIC var use four PCODE.


        Thanks!

        Patrick

    Walter Negro


    No virus found in this outgoing message.
    Checked by AVG - http://www.avg.com
    Version: 8.0.175 / Virus Database: 270.9.4/1791 - Release Date:
    15/11/2008 06:57 p.m.

    -------------------------------------------------------------------------
    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=/
    <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
    _______________________________________________
    xHarbour-developers mailing list
    [email protected]
    <mailto:[email protected]>
    https://lists.sourceforge.net/lists/listinfo/xharbour-developers


------------------------------------------------------------------------

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


No virus found in this incoming message.
Checked by AVG - http://www.avg.com Version: 8.0.175 / Virus Database: 270.9.4/1791 - Release Date: 15/11/2008 06:57 p.m.

  
No virus found in this outgoing message.
Checked by AVG - http://www.avg.com
Version: 8.0.175 / Virus Database: 270.9.4/1791 - Release Date: 15/11/2008 
06:57 p.m.
-------------------------------------------------------------------------
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

Reply via email to