Announcement

Collapse
No announcement yet.

efficiency

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • efficiency

    Hi all,

    I have 2 functions that both need to do similar things. Basically I can do it by either writing a third parametric function or I can write a third and a fourth function. ie,

    function One(){ ...
    ... DoSomethingOne();...}

    function Two{....
    ...DoSomethingTwo()...}

    function DoSomethingOne(){...
    ...}

    function DoSOmethingTwo(){...
    ....}

    In the above case what I get is 16 extra general (not global) variables and a longer script with similar lines of code.

    OR the second way is.

    function One(){ ...
    ... DoSomethingOne(1);...}

    function Two{....
    ...DoSomethingTwo(1)...}

    function DoSomethingOne(CallingFunction){...
    if (CallingFunction==1) {} ...etc.

    ...}

    In this case I only use 4 local variables but I have to have too many if...then..else.. statements.

    What I am asking is which one is more efficient in EFS? I have to compute those functions at every new tick. So does anybody know which code will keep the computer less busy or use less resources? Or are they both the same in terms of efficiency?

    Thanks in advance

  • #2
    Hello balligil,

    At first glance, I don't think there would be much difference between the two. You could use the EFS Performance Monitor (Tools-->EFS) to find out exactly what the difference is in terms of speed of execution. Create the two versions of your code and compare them with this tool. You'll get total time and average time in milliseconds.
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment

    Working...
    X