It takes too long - searching

Top  Previous  Next

Sometimes code executes too slow to wait or to put in profile and get the output (i.e. it runs for 3 hours and shows no signs of abating).  But if I abort the job the operating system buffer handing procedures generally cause loss of the last few lines of profile information when the job was aborted.  So how do I find the problem?  The answer is I use

 

 The problem reduction strategies in the small to large chapter

or

 Search using code deactivation and isolation

 

The former involves the modeling simplification strategies discussed in the small to large chapter along with the profile and memory dump techniques discussed above with the and will not be elaborated on here.  The latter merits discussion.

When I have code that just won't work fast enough to wait, I can engage in a quest for the last good statement.  This can be done by using code deactivation by commenting out statements using

 

$Ontext/$Offtext to temporarily make comments of active statements

Making individual lines into comments using *

 

In turn, I would successively deactivate more and more statements until the performance changes with the job terminating appropriately.  I would then slowly activate members of the last code statements deactivated until the code performance got worse again.  Then by iteratively activating and deactivating I can isolate the exact problematic terms.  I may also use save restart to speed this up by saving the results up until a known good spot and just executing the suspect statements.