Re: Shapefile Woes [message #77822 is a reply to message #77821] |
Thu, 06 October 2011 10:27   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> My tests are with the gsshs_i_L1.shp file, an intermediate
> resolution file. The Draw Shapes file has loop in which each
> polygon shape in the file is rendered, and then it destroys
> the shapefile object is was using (IDLffShape), and then
> it destroys the entities from the shapefile (these are
> pointers), using Heap_Free. There are 33441 individual
> entities (polygons) in this file.
>
> IDL Print, N_Elements(*entities)
> 33441
> IDL> Heap_Free, entities
>
> I have timed the process in IDL 7.2 and in IDL 8.1.
> Here are the numbers:
>
> IDL 7.2
>
> loop: 0.177 seconds
> destroy object: 0 seconds
> destroy entities: 63.852 seconds
>
> IDL 8.1
>
> loop: 0.193 seconds
> destroy object: 0 seconds
> destroy entities: 90.604 seconds
>
> That is a LONG time to be freeing up pointers!
>
> Interestingly, in several trials in IDL 8.1 the freeing of the
> entities took from a minimum of 65 seconds to a maximum of 102
> seconds. The recorded time was from the first trial.
>
> Does this seem slow to you, or reasonable?
Yowser!! This time I tried freeing up the pointers as
I go. Instead of running through the loop of polygons,
then freeing everything at the last moment with Heap_Free,
I tried this:
FOR j=0,N_Elements(*entities)-1 DO BEGIN
thisEntity = (*entities)[j]
...
Ptr_Free, thisEntity.vertices
Ptr_Free, thisEntity.measure
Ptr_Free, thisEntity.parts
Ptr_Free, thisEntity.part_types
Ptr_Free, thisEntity.attributes
ENDFOR
Obj_Destroy, shapefileObj
Ptr_Free, entities
Here are the numbers for IDL 8.1:
loop: 9.566 seconds
destroy object: 0 seconds
destroy entities: 0.009 seconds
I guess I could live with that! There must be a lession
in here somewhere! :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|