[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Important object lesson



Phillip David (pdavid@earthling.net) writes:

> I've been doing some more playing around with objects, and learned that there
> is a HUGE difference between creating an object with a null constructor and
> destructor and creating an object with no constructor or destructor.  

>  [Code with and without constructors and destructors snipped.]

> When I actually timed these two methods, I found that there was a factor of
> about 200,000 times between the two.  WOW!  I had time to create and destroy
> 200,000 test1 objects for every test2 object I created.
> 
> The moral of this story is:  ALWAYS define your constructors and destructors
> when defining IDL objects.

Actually, I think this is a function of how many directories you have
on your path. If the INIT and CLEANUP methods are not compiled when
IDL has to use them, it looks for a file named myclass__init.pro or
myclass__cleanup.pro in the directories specified by the !PATH
system variable. If you have a lot of files there, it can take
a long time!

Cheers,

David
___
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/