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

Home » Public Forums » archive » How to speed up large FOR loops?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
How to speed up large FOR loops? [message #79814] Tue, 10 April 2012 08:48 Go to next message
Saurav Dhital is currently offline  Saurav Dhital
Messages: 4
Registered: April 2012
Junior Member
Hi,

By necessity, I have to use a long FOR loop (N >~ 300,000). I have
made the operations inside the loop efficient enough that the first
40,000 iterations are relatively fast (~30 mins). Then it slows down
to a crawl, with the entire process taking >24 hours. I would
appreciate any advice how to speed this up.

The operation inside the loop involves matching between two (large)
FITS files and assigning the matches to another (previously created)
FITS structure. There are no new variable created per iteration, so
there should be no memory being used (each loop writes over the
variables anyways). I even create small substructures (e.g., >
sub_mystruct = mystruct[0:10]) so that I don't have to index the large
structures.

Any tip or advice would be much appreciated,
~Saurav
Re: How to speed up large FOR loops? [message #79980 is a reply to message #79814] Fri, 20 April 2012 09:53 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Saurav writes:

> Thanks! I will use th profiler, probably David's as I already use a
> lot of his code.

David doesn't have a profiler. He still uses friggin' Print
statements like all the other old fogies I know. :-(

Cheers,

Coyote


--
Coyote, R.N, USMC
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: How to speed up large FOR loops?
Next Topic: Manipulation with 4D data in iVolume tool

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

Current Time: Wed Oct 08 15:49:07 PDT 2025

Total time taken to generate the page: 0.00523 seconds