Timing of statements inside a cell
- To: mathgroup at smc.vnet.net
- Subject: [mg50841] Timing of statements inside a cell
- From: János <janos.lobb at yale.edu>
- Date: Thu, 23 Sep 2004 05:27:24 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
I have a cell with some code in it containing many statements. Like:
Cell starts here
...
...
currentTargetPartitioned = Partition[currentTarget, primerLength, 1];
prposBin = {{1}, {currentTargetLength}};
(* Do as long as the Mean of
the distance between
neighbouring primers is bigger than averagePrimerDistance *)
While[Mean[Flatten[Map[#[[2]] - #[[1]] &, Partition[prposBin, 2, 1]]] ]
> \
averagePrimerDistance, (
pr = random[currentTargetPartitioned];
prpos = Position[currentTargetPartitioned, pr];
prposBin = Sort[Flatten[Append[prposBin, Flatten[prpos] ] ] ];
)];
(* Create a double strand
from the currentTarget in such a way that the double starts
from
the first primer position and file it into collectedDnaBin *)
prposBinDouble = Most[Map[{#, Last[prposBin]} &, prposBin] ];
collectpr = Take[currentTarget, prposBinDouble[[2]] ];
...
...
Cell ends here
I would like to time every single statement as they are executing.
Just adding //Timing after every statement or wrapping them with
Timing[statement;] does not work.
Any good hint ? /I am sure I am not the only one needing it :)/
In general, what kind of profiling Mathematica allows to pinpoint the
statements inside a single cell which spend the most time in the kernel
?
If it cannot be done inside a cell, what is possible baring to break
the cell into single statements cells ? What should I read ?
Other question: In the While loop above I am collecting positions into
a list
prposBin = Sort[Flatten[Append[prposBin, Flatten[prpos] ] ] ];
/Just realized that I should do the Sort outside of the loop :)/
How can I do the collection with Sow and Reap to avoid Append ?
Thanks ahead,
János
P.S.
----------------------------------------------
Trying to argue with a politician is like lifting up the head of a
corpse.
(S. Lem: His Master Voice)
- Follow-Ups:
- Re: Timing of statements inside a cell
- From: DrBob <drbob@bigfoot.com>
- Re: Timing of statements inside a cell
- From: János <janos.lobb@yale.edu>
- Re: Timing of statements inside a cell