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

Home » Public Forums » archive » Re: Object overhead
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Object overhead [message #26760 is a reply to message #26744] Sat, 22 September 2001 07:50 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"Pavel A. Romashkin" <pavel.romashkin@noaa.gov> writes:

> I noticed that the size of an object array, where each object only has
> one empty poiter field, is 4 times larger than the size of an empty
> pointer array of the same length. PTRARR(1000), when saved, takes about
> 44 Kb. OBJARR(1000) of {junk, data:PTR_NEW()} takes 176 Kb. Why is that?
> Also, it takes twice the time (0.79 vs 0.44 s) to save an object array
> than the pointer array. It can not have to do with the volume of saved
> data because it takes 0.05 s to save an 80 Kb FLTARR(20000).

Hi Pavel--

Since I've mucked around with the format of save files, and in fact
made a library to manipulate them, I think I can try to answer your
questions.

Saving a FLTARR() is fast because IDL can simply write out a block of
floating point numbers in one operation. [ after converting to
standard endian-ness, of course ]

Saving a PTRARR() is slower, because IDL must scan through the entire
array looking for non-null pointers. You actually gave an example
that was too trivial. If you tried populating your PTRARR(1000) with
values, you will find that the save file becomes much larger and take
much longer to create. That's because IDL must save each heap
variable separately. This is invisible to you, but it happens.

Finally, an array of objects is more complicated still. Objects are
really structures. Since structures are more or less infinitely
flexible, much more complicated programming is used to save them, and
there is extra metadata information related to structures, that must
also be saved.

Vector support for structures and pointers has never been as strong as
for simple data types, and this shows in how they are save as well.

Hope this helps!
Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: map_set, state county borders
Next Topic: playing sound from within IDL

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

Current Time: Sun Oct 12 12:35:19 PDT 2025

Total time taken to generate the page: 1.27855 seconds