Re: Most Common IDL Programming Errors [message #59900 is a reply to message #59761] |
Fri, 11 April 2008 13:52   |
R.G. Stockwell
Messages: 363 Registered: July 1999
|
Senior Member |
|
|
"Vince Hradil" <hradilv@yahoo.com> wrote in message
news:b4e816fa-1c96-44a1-96bb-1a4e7395d376@24g2000hsh.googleg roups.com...
> On Apr 11, 12:41 pm, "R.G. Stockwell" <notha...@noemail.com> wrote:
>> <sav...@nsidc.org> wrote in message
>>
>> news:ywkufxtss6b9.fsf@snowblow.colorado.edu...
>>
>>> "R.G. Stockwell" <notha...@noemail.com> writes:
>>
>>>> a = fltarr(len) + !values.f_nan
>>
>>> What about
>>> a = make_array(len, value=!values.f_nan)
>>
>>> That's what I use. I'm sure it saves me some computational power by not
>>> having
>>> to compute those values I'm just going to overwrite anyway. :)
>>
>> You know, I am just the kind of person who will end up time testing
>> those variations. And seeing what operation is faster: fltarr(len) +
>> !values.f_nan,
>> fltarr(len) - !values.f_nan, fltarr(len) * !values.f_nan, or
>> fltarr(len)/!values.f_nan
>>
>> :)
>>
>> Cheers,
>> bob
>
> I'm waiting with bated breath. 8^)
Here they are (10k iterations, ran loops over the different
commands, repeated them in different orders, all functions and arrays
were previously created):
(and by the way WOW! - make array wins)
plus 89.172000 Seconds.
minus 89.188000 Seconds.
multiply 90.531000 Seconds.
divide 89.485000 Seconds.
makearray 2.0000000 Seconds.
makearray 1.9840000 Seconds.
divide 90.250000 Seconds.
multiply 90.219000 Seconds.
minus 88.797000 Seconds.
plus 88.125000 Seconds.
|
|
|