Message Boards Message Boards

GROUPS:

Bottlenecking Code

Posted 5 years ago
13838 Views
|
2 Replies
|
5 Total Likes
|
Hey guys,

So I'm working with a pretty large block of code and the thing is moving way slower than it should be in theory. Is there a way that I can monitor exactly where in the code Mathematica is working at any given moment?

Thanks bros!
2 Replies
Posted 5 years ago
While this will not tell you exactly where in the code Mathematica is working at any given moment, this
LinkWrite[$ParentLink,
SetNotebookStatusLine[FrontEnd`EvaluationNotebook[], "Beginning to evaluate xxx"]];
can be placed at appropriate places in your code and it will display the string in the lower left corner of the notebook "status line."
You can even enhance that by using ToString in conjunction with StrinJoin to splice in the values of expressions if that will help.
Putting one of those before each potentially time consuming block of code can help you diagnose where things are slowing down.
In Evaluation > Debugger mode, you can use  RuntimeTools`Profile[ (* your code here *)]  to get how much time is spent on each statement.  Not exactly what you asked for, but assuming your command finishes, it might be helpful nonetheless.
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract