Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
90 milliseconds to call simple function
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00216437
Message ID:
00216572
Vues:
32
>Peter,
>
>Is this UDF in it's own PRG file and is the first executable line:
>
>FUNCTION ICantBelieveThisIsSoSlow(...)
>
>If so, simply comment out the FUNCTION declaration and see if it speeds it back up. I've never gotten an adequate explanation as to why this slows FoxPro down so badly, but it definately does.
>
David,

Terrific catch! I think you may found the reason for Peter's problem.

To demonstrate, I created a function (named Foo, the industry standard name < g >). Foo accepts no parameters, nor returns a value. This takes the unnecessary overhead of the assignment statement and the parameter call out of the mix. Here's the code I used to test:
FUNCTION Foo
  RETURN
ENDFUNC
* Test code
lnstart = SECOND()
FOR lin = 1 TO 10000
 = Foo()
NEXT
lnstop = SECONDS()
? lnstop - lnstart
When the FUNCTION/ENDFUNC were present, the average total time for the calls were 84.166. Without the FUNCTION/ENDFUNC pair, the average total time was 0.103. The test was run on a P200 with 64 mgb of RAM (sorry, I'm behind the hardware curve here< bg >).
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform