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 #21529 is a reply to message #21521] Thu, 31 August 2000 06:40 Go to previous messageGo to previous message
edward.s.meinel is currently offline  edward.s.meinel
Messages: 12
Registered: May 1999
Junior Member
In article <onn1huybd3.fsf@cow.physics.wisc.edu>,
craigmnet@cow.physics.wisc.edu wrote:
>
> 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.
>

So does that mean that form (3) is slower than form (1)?

(3) for j=0,2047 do $
for i=0,2047 do $
outarr[i,j]=median(inarr[*,i,j])

I guess that would mean that readable code is slower than unreadable
code...

Ed Meinel


Sent via Deja.com http://www.deja.com/
Before you buy.
[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: Fri Oct 10 17:16:36 PDT 2025

Total time taken to generate the page: 2.40025 seconds