Re: Initialize new variable array with nan or -9999 values [message #87664 is a reply to message #87663] |
Fri, 21 February 2014 06:58  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
John Correira writes:
> MAKE_ARRAY is faster on my machine:
>
> IDL> tic
> IDL> for i=0,9 do a=fltarr(1000,1000,100)-9999.
> IDL> toc
> IDL> help, a
>
> Elapsed time is 3.018326s
> A FLOAT = Array[1000, 1000, 100]
>
> IDL> tic
> IDL> for i=0,9 do a=make_array(1000,1000,100,value=-9999.)
> IDL> toc
> IDL> help, a
>
> Elapsed time is 2.075103s
> A FLOAT = Array[1000, 1000, 100]
>
> IDL> print,!version
> { x86_64 linux unix linux 8.2 Apr 10 2012 64
> 64}
I think you have to be a little careful how you do this experiment. But,
starting IDL from scratch each time (.reset) and then running the
Make_Array method or the Add-To method, I get these results on my
Windows 64-bit machine with IDL 8.2.3:
Make_Array Method: 1.572
Add-To Method: 1.811
Maybe 15% faster. I don't think I would be losing sleep over it. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|