Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multiple SET CLASSLIB ADDITIVE
Message
From
16/10/2001 11:32:35
 
 
To
15/10/2001 18:04:26
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00567232
Message ID:
00569058
Views:
20
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform