Re: a little bit faster... [message #9582] |
Mon, 14 July 1997 00:00 |
Inigo Garcia
Messages: 13 Registered: June 1997
|
Junior Member |
|
|
Liam Gumley wrote:
>
> Sometimes we need to plot spectra which contain millions of points. It
> appears to be faster to use PLOTS (rather then PLOT).
>
> Try the following:
>
> n = 1000000L
> x = lindgen(n)
> y = sin(2.0*!pi*findgen(n)/(n-1))
> t0 = systime(1.0) & plot,x,y & print,systime(1.0)-t0
> t0 = systime(1.0) & plot,x,y,/nodata & plots,x,y & print,systime(1.0)-t0
>
> On my SGI Power Indigo running IDL 5.0, it takes 21.43 sec for the first
> plot, and 12.46 sec for the second plot. I observe similar speedups on
> Linux (IDL 5.0) and Windows NT 3.51 (IDL 4.0.1).
>
> Cheers,
> Liam.
Hi ! I really liked your tip, and I have added some speed to it:
I get in a UltraSparc with Solaris:
IDL> n = 1000000L
IDL> x = lindgen(n)
IDL> y = sin(2.0*!pi*findgen(n)/(n-1))
IDL> t0 = systime(1.0) & plot,x,y & print,systime(1.0)-t0
9.2730690
IDL> t0 = systime(1.0) & plot,x,y,/nodata & plots,x,y &
print,systime(1.0)-t0
7.3343741
IDL> t0 = systime(1.0) &plot,[min(x),max(x)],[min(y),max(y)],/nodata &
plots,x,y & print,systime(1.0)-t0
6.3368920
Cheers,
I~nigo.
--
\\|//
(o o)
+-----------------------oOOo-(_)-oOOo----------------------- --+
| I~nigo Garcia Ruiz |
| Kapteyn Instituut Phone: +31-(0)50-3634083 |
| Landleven 12 Fax: +31-(0)50-363 |
| 9747 AD GRONINGEN (Netherlands) e-mail: iruiz@astro.rug.nl |
+----------------------------------------------------------- --+
|
|
|