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:
01207872
Vues:
27
The link Gregory pointed you to has a link to Calvin's blog, but I will post it here as a separate reference
http://blogs.msdn.com/calvin_hsia/archive/2004/12/14/301282.aspx


>(0) please define 'outside' and 'inside' the application
>
>Inside by way of timers or a coverage log of an area with many calls to the function in question.
>
>Outside by way of setting procedure only to the library of the function and calling it in a loop. One possibility is that Fox caches the function when it's called repeatedly but un-caches it when it's being called in the application since in the application we have lots of code called between each call to the function.
>
>Naomi mentioned that having multiple "set procedures" in memory (for us roughly 30) and/or multiple "set classlib" set could slow us down. If that's the case then we're pretty much screwed. There's no way we can clear out our classlibs and libraries everytime we call the function.
>
>(1) Prefix all variables including object references, (even functions maybe) with m.
>
>I've seen this done with the generated code when you create an assign/access method for a property. What does this accomplish?
>
>(2) Any way to avoid the call, ie work with a #define so that the code is repeated in a 'controlled' way
>
>We're currently working a solution that heads in this direction. The function in question retrieves data from meta tables for us. We're trying a dynamic load solution that scatters the meta-table record in question to an object wherein we can simply evaluate an object.property reference to get the values we're after instead of calling the function. Unfortunately this means rewriting a lot of code.
>
>(3) Passing parameters takes time as well, especially (long) strings
>
>N/A
>
>(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
>
>N/A. This is a function in a prg.
>
>(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
>
>See previous.
>
>(6) a piece of code might help, ie the function and how it is called
>
>Unfortunately I can't do that, and like I said the internals of the function are extremly fast. It opens an indexed table, seeks, and returns. I can offer this:
>
>GetMyMetaInformation( tcDatabaseFieldName, tcMetaFlag, tcMetaField )
>
>ie: GetMyMetaInformation( 'inspections.reading', 'U', 'caption' ) would return the stored caption for inspections.reading which is a calculated ("U") field.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform