[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: speed of n_elements



Pavel Romashkin <promashkin@cmdl.noaa.gov> writes:
> 
> > * I can't repeat your experience on Sun or Linux.  On both those
> >   machines n_elements(data.flag) is much slower than n_elements(data),
> >   at least in a loop.
> 
 .... program deleted ...
> IDL> a=fltarr(1000)
> IDL> b={a:a, b:a, c:a, d:a, flag:0L, name:'', other:0.0}
> IDL> c=replicate(b, 500)
> % Compiled module: TEST.
> IDL> k={a:0L, data:c}
> IDL> test,k
>        33.133333
>      0.033333302

Okay, now I agree with you.  It should be clear that branch that takes
longer, a.data, has to extract a lot more data than a.data.flag.  As I
said some reason IDL is very clumsy about structures with big arrays
in them (and I was talking about megabyte arrays).

> ... In my opinion, the only drawback in
> using pointers and (built-in) objects is that they take away from you some of
> the tremendous advantages that IDL has in handling arrays.

I agree.  I'm not a huge fan of pointers unless I have to, especially
since I'm still trying to keep some IDL 4 compatibility.

Craig

-- 
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------