comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Philosophy of for loops
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Philosophy of for loops [message #21564 is a reply to message #21521] Wed, 30 August 2000 00:00 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
landsman@my-deja.com writes:
> (1) for j=0,2047 do for i=0,2047 do outarr[i,j] = median(inarr[*,i,j])
>
> (2) for j=0,2047 do begin
> for i=0,2047 do begin
> outarr[i,j] = median(inarr[*,i,j])
> endfor
> endfor
>
> Form (1) is slightly faster, but the calculation cannot be interrupted
> with a Control-C. Also, it is my impression that the speed difference
> is less than it used to be, and that form (2) is now better optimized.

I hadn't realized these were different! My choice between the two
forms usually revolves around stylistic concerns, i.e., does the thing
fit on the line. My guess is that form (2) is a little slower
*because* it is doing the keyboard checking. I have some roundabout
evidence that this is true.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Landsat 7 and IDL Insight
Next Topic: list widget

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 02:39:54 PDT 2025

Total time taken to generate the page: 1.35894 seconds