[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Undocumented array indexing feature?
- Subject: Re: Undocumented array indexing feature?
- From: Martin Schultz <mgs(at)io.harvard.edu>
- Date: Tue, 26 Jan 1999 09:50:43 -0500
- Newsgroups: comp.lang.idl-pvwave
- Organization: Dept. for Engineering&Applied Sciences,Harvard University
- References: <36A792FF.DA5E1E31@ssec.wisc.edu> <36A8962D.428A16D5@ssec.wisc.edu> <36A8B556.DE735D13@astrosun.tn.cornell.edu> <Pine.SO4.4.03.9901221328390.15597-100000@virgil.gsfc.nasa.gov> <78hvaq$kfe$1@nnrp1.dejanews.com> <36AC8341.EC8@rosa.mpin-koeln.mpg.de> <78ileb$7nq$1@nnrp1.dejanews.com> <36AD878D.579389C1@fz-juelich.de>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:13447
R.Bauer wrote:
> > Bill B. wrote:
> [...]
> > Oh, I knew that one, Alex. Anyone know which method offers faster execution -
> >
> > a = 0 & b = 0 * OR * a = (b = 0)
> >
> > this is important when applying the same principle to large arrays. At least
> > to those of us with slower PCs :(
>
> Initializing of big arrays should be done by a=make_array(200,100000,/nozero)
> This is the fastest method
>
> R.Bauer
but then you have them uninitialized! A fair comparison is
a = make_array(dim1,dim2,type)
Here is some timing info (IDL 5.1 on SGI Origin 2000):
[only one pass each, but these numbers don't change much]
A1 = FLTARR(1000,1000) & A2 = FLTARR(1000,1000)
0.031656981 + 0.032227993 = 0.063884974 seconds
B2 = ( B1 = FLTARR(1000,1000) )
0.085137010 seconds
C1 = MAKE_ARRAY(1000,1000,/FLOAT) & C2 = ...
0.037186027 + 0.040596962 = 0.077782989 seconds
D1 = MAKE_ARRAY(1000,1000,/FLOAT,/NOZERO) & C2 = ...
0.00017607212 + 0.00011897087 = 0.00029504299 seconds
Regards,
Martin.
--
-------------------------------------------------------------------
Dr. Martin Schultz
Department for Engineering&Applied Sciences, Harvard University
109 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA
phone: (617)-496-8318
fax : (617)-495-4551
e-mail: mgs@io.harvard.edu
Internet-homepage: http://www-as.harvard.edu/people/staff/mgs/
-------------------------------------------------------------------