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

Home » Public Forums » archive » Re: Assignment Time for a 3d Variable
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: Assignment Time for a 3d Variable [message #46465 is a reply to message #46464] Wed, 23 November 2005 10:35 Go to previous messageGo to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
David Streutker wrote:
> David Fanning wrote:
>> The speed differences have to do with how you access different
>> parts of the array in memory. If the parts you want are contiguous,
>> then you can get them faster than you can if they are far apart in
>> memory. (Think how much faster it is to pick up the poker
>> chips when they are stacked than when they are scattered all
>> around the table.)
>>
>> To make these kinds of assignments as fast as possible, use
>> the TRANSPOSE function to organize the data into the fastest
>> possible position:
>>
>> IDL> Help, data
>> DATA BYTE = Array[3, 227, 149]
>> IDL> data = Transpose( Temporary(data), [2,3,1] )
>> IDL> Help, data
>> DATA BYTE = Array[227, 149, 3]
>
> How does one know which is the fastest possible position? Should the
> largest dimension be first? Nuno's example seems to imply that the
> first dimension is not the fastest accessed.

Note: Nuno's third case was identical to his second one; the time
variation must have been random. With the third case corrected to:


for k = 0, 99 do $
temp = vol[*,*,k]
print, 'execution time (for z axis): '+STRING(systime(1) - time)

I get:

execution time (for x axis): 0.18765187
execution time (for y axis): 0.038336992
execution time (for z axis): 0.031430006

If you're accessing consecutive positions along one dimension of an
object, then the first dimension is in fact the fastest one, because
those consecutive positions are physically adjacent to each other..
That corresponds the fastest case, the third one. The slowest case was
when only one position along the first dimension was accessed for all
possible values along the other two dimensions.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Creating Panels in iTools
Next Topic: How should I mark annotations in multi plot window

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

Current Time: Fri Oct 10 13:40:04 PDT 2025

Total time taken to generate the page: 1.19916 seconds