Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
An expesive (timewise) line
Message
De
02/03/2001 05:05:38
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
01/03/2001 19:26:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00481193
Message ID:
00481257
Vues:
12
>I'm trying to optimize a form-based business object. In testing I've set up a program which calls the form using
>Do form boExtInv Name oBOExtInv Linked Noshow
>
>This business object was handling 100 transactions in about 36 seconds. After working at it a bit I got it down to 100 trans in 25 seconds mainly by inlineing some code and getting rid of macro expansion. Just for a lark I removed the business method call whose function is to initialize the object variables. This method contains a block of code like
>
>With oObject
> .cVarname = 0
> .tVarname = {}
> ... and so on
>Endwith
>
>Now the program is handline 100 transactions in 12 seconds. Now I added in one line to the scan ... endscan loop that sets one object variable to 0, and the time goes back to 25 seconds. So inlineing one command which sets an object
>variable to 0 doubles the time that the scan .. endscan requires to traverse 100 records.
>I'm going to pull out the Mac Rubel articles in Foxpro Advisor and reread them but does this sound right?

Michael,
Setting an object property takes too much time compared to setting a memvar. However it's not quite measurable in 100 transactions.
IMHO not just setting the property value but consequences it causes might be increasing the time. For testing create another object of any type and set its say tag property in loop to see if time changes significantly. If it does try with a memvar (honestly I tend to use memvars and set object properties after completion as possible).
OTOH if that property value is not used at all just setting it once outside of loop is more appropriate. Probably it's used so another option is to set it to something like :
.Varname = iif(llSomething, luSomeValue, 0)
It might decrease calls to it.
Actually though what I noticed is 12 secs for 100 transactions. Of course with hardware and complexity of a transaction it might be a perfect timing. I wonder if in fact it's not so complex and there are other bottlenecks in code. Depending of what's needed even changing from a form to custom, container, relation object you might gain speed as well.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform