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

Home » Public Forums » archive » Re: Doing Nothing Takes Longer Than Doing... Nothing?
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: Doing Nothing Takes Longer Than Doing... Nothing? [message #37990] Wed, 11 February 2004 09:17 Go to previous message
justspam03 is currently offline  justspam03
Messages: 36
Registered: October 2003
Member
Hi,

same on my machine - minimal but consistent time differences.
Differences when calling the same function in both loops are
negligible, though.
I found that adding a call to one of the two test functions
before the main loop will make the loop that calls this function
run faster.
E.g. in your test program below with the added line, the 2nd
loop runs faster than the 1st.
Maybe (wild speculation mode on) it's got to do with how IDL
internally manages function calls/function lists - calls to
functions further up in the list would be faster than calls to
functions further down the list? (wild speculation mode off)
Cheers
Oliver





>
> ;==================================
> pro testroutine1
> end
> ;==================================
> pro testroutine2
> end
> ;=================================
> pro testroutine3
> end
> ;=================================
> pro benchmark
>
> NREPS=5000L
> NAVGS=50L
>
> profiler, /SYSTEM, /CLEAR, /RESET
> profiler,'testroutine1'
> profiler,'testroutine2'
> profiler,'testroutine3'
>
> ;===== added this line ====
> testroutine2
>
> delt1 = dblarr(navgs)
> delt2 = dblarr(navgs)
> for j = 0L, navgs-1L do begin
>
> ; TIME ROUTINE NUMBER 1...
> tstart = systime(1)
> for i = 1L, nreps do begin
> testroutine1
> endfor
> delt1[j] = (systime(1)-tstart)
>
> ; TIME ROUTINE NUMBER 2...
> tstart = systime(1)
> for i = 1L, nreps do begin
> testroutine2
> endfor
> delt2[j] = (systime(1)-tstart)
>
> ; UPDATE OUR PROGRESS...
> print, 100*j/(navgs-1), format='($,"Progress: ",I4,"%",%"\R")'
>
> endfor
>
> ;==============
> ; GET THE AVERAGE TIMES...
> avg1 = delt1/double(nreps)
> avg2 = delt2/double(nreps)
>
> ;==============
> ; GET THE MEANS...
> mnavg1 = total(avg1,/DOUBLE)/double(navgs)
> mnavg2 = total(avg2,/DOUBLE)/double(navgs)
>
> ; TELL US ABOUT THE RESULTS...
> print, mnavg1, format='(2(%"\V"),"Average1 = ",e16.7," s")'
> print, mnavg2, format='("Average2 = ",e16.7," s",%"\V")'
>
> ; WHAT DOES IDL CODE PROFILER REPORT...
> print, 'IDL Code Profiler reports:'
> profiler, /REPORT
> profiler, /CLEAR
>
> end; benchmark
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Label Region trouble
Next Topic: dissapointing fftw

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

Current Time: Wed Oct 08 17:37:06 PDT 2025

Total time taken to generate the page: 0.00425 seconds