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

Home » Public Forums » archive » Today's IDL Lesson
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: Today's IDL Lesson [message #62009 is a reply to message #61926] Fri, 15 August 2008 02:05 Go to previous messageGo to previous message
Allan Whiteford is currently offline  Allan Whiteford
Messages: 117
Registered: June 2006
Senior Member
David Fanning wrote:
> Kenneth P. Bowman writes:
>
>
>> Shouldn't that be "increases linearly with the image size and
>> number of invocations of WHERE"?
>
>
> I don't think so. A 1500x1500 array took about 3.2 sec.
> a 2500x2500 array took about 35 sec. Just eyeballing it,
> it doesn't look linear to me. :-)
>
> Cheers,
>
> David

This scared me!

So, I wrote the following:

pro profile_where

max=26
time=fltarr(max)
sizes=(1+2*(findgen(max) mod 3))*10l^float(indgen(max)/3)

for i=0l,max-1 do begin
array=findgen(sizes[i])
time[i]=call_external('libidl.so','clock')
idx=where(array lt 3)
time[i]=call_external('libidl.so','clock') -time[i]
end

plot,sizes,time/1e6,xtitle='Number of elements',ytitle='Time in s'
oplot,sizes,time/1e6,psym=2

; or...

plot,alog10(sizes),alog10(time/1e6),xrange=[5,10]
oplot,alog10(sizes),alog10(time/1e6),xrange=[5,10],psym=2

end

and I get something which looks basically linear. The maximum array size
were chosen so that I wasn't hitting swap space and the where()
criterion so that each iteration returned the same number of results
(hence allocated the same amount of memory).

I have no doubt that in real world applications we get non-linear
scaling due to hitting swap or various other reasons but I think the
above shows that the basic usage of where() has linear scaling.

I hope this is as much a relief to others as it is to me.

Thanks,

Allan
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: matrix multiplication of 2 three-dimensional arrays
Next Topic: find positions in vectors

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

Current Time: Fri Oct 10 04:57:23 PDT 2025

Total time taken to generate the page: 1.19848 seconds