Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Multiple SET CLASSLIB ADDITIVE
Message
De
16/10/2001 11:32:35
 
 
À
15/10/2001 18:04:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00567232
Message ID:
00569058
Vues:
21
Hi Marcia.

>>> The only problem with NewObject is that it's considerably slower than CreateObject. <<
>
>Is that always true? I thought that if you used NewObject() and the specified Classlib was already loaded into memory, that it could be even faster that CreateObject(). Or am I on Mars with this one <g> ?

It's been a while since I last tested this, but here's the process underlying NEWOBJECT():

- close all opened class libraries
- open the specified one
- instantiate the class
- close the specified class libraries
- reopen the previously open ones

IMO, this is just dumb -- it should check to see if the specified class library is already open and use it if so.

You can prove that this is the behavior by doing this:
SET CLASSLIB TO (some VCX not in path or curdir)
X = NEWOBJECT('someclass', 'VCX opened in previous line')
You'll get a "file whatever.vcx does not exist" error.

Since VFP has to close and reopen all those class libraries on every call to NEWOBJECT(), it ought to be slower than CREATEOBJECT().

Doug
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform