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

Re: speed of n_elements




Pavel Romashkin <promashkin@cmdl.noaa.gov> writes:
> So, briefly: if you want to get the size of an array of structures,
> examine the size of an array of scalar fields (if available) and you
> will have 10X5 faster n_elements.

Two things:

* 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.

* I've always found that putting large data arrays into structures is
  a big loser.  In my experience it's slow to create such structures
  and slow to extract the fields later.  Thus I was surprised by your
  observation (but unfortunately I can't confirm it); however because
  of that I still avoid large arrays in structures.  Use pointers or
  handles instead.

Craig

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