Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Slow Function Calls
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
01207662
Message ID:
01207683
Vues:
15
>I apologize if this answer can already be found in the archives. I no longer carry a full membership here at UT.
>
>We're running into a problem with slow function calls. While most problems of this likeness can be solved by simply making the function faster, the code inside the function executed alone is actually faster than the time it takes to call the function.
>
>4000 calls outside the application = 0.3
>4000 calls inside the application = 3.0
>
>We've put numerous timers on this to ensure that the slow part is the actual calling of the function and not the code inside.
>
>I figure at this point someone out there has run into this. If you stumbled onto a solution I'd love to hear it.
>
>Thanks

(0) please define 'outside' and 'inside' the application

(1) Prefix all variables including object references, (even functions maybe) with m.

(2) Any way to avoid the call, ie work with a #define so that the code is repeated in a 'controlled' way

(3) Passing parameters takes time as well, especially (long) strings

(4) Are the calls in an object, ie something like =m.this.Function() and Function() is hidden/protected ?
Take the hidden/protected away. It's not 'very' clean, but it speeds up

(5) when calling object methods or accessing their properties multiple times, sometimes 'with / endwith' can help.
If it is only a couple of times, with/endwith tend to slow it down

(6) variable creation/destruction takes time as well
&& if an expression is used only a couple of times, do not assign its result to a variable, rather repeat the expression

lparameters x

=funct(x + 2)

cc = x + 2 + pp

&& is faster then
lparameters x

local a
a = x + 2
=funct(a)

cc = a + pp
(7) a piece of code might help, ie the function and how it is called
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform