comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Important object lesson
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Important object lesson [message #12110] Tue, 23 June 1998 00:00 Go to previous message
Phillip & Suzanne is currently offline  Phillip & Suzanne
Messages: 31
Registered: June 1998
Member
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. I'll
show a sample snippet of each, then explain.

---- file test1__define.pro ----

pro test1::cleanup
end

function test1::init
return, 1 ; success
end

pro test1__define{
struct = {TEST1, NULL:0b}
}

---- end test1__define.pro ----

---- file test2__define.pro ----

pro test2__define{
struct = {TEST2, NULL:0b}
}

---- end test1__define.pro ----

When I perform obj1 = Obj_New('test1'), it takes virtually no time. obj2 =
Obj_New('test2') takes about 3 1/2 seconds (on a Pentium Pro 200 running
Windows NT 4.0 and IDL 5.1). Similarly, calling Obj_Destroy, obj1 takes
virtually not time, but Obj_Destroy, obj2 takes about 3 1/2 seconds as well.
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.

Phillip David
IDL Tool Developer
XonTech, Inc
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Transparent surfaces?
Next Topic: Re: Determining machine endian-ness

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 23:06:51 PDT 2025

Total time taken to generate the page: 1.27950 seconds