Profiler for Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg36463] Profiler for Mathematica
- From: Husain Ali Al-Mohssen <husain at MIT.EDU>
- Date: Sun, 8 Sep 2002 03:30:38 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi All, I have been trying to code Sethian's Fast Marching Method in 2D but Mathematica has been very slow (taking something like 1-2 hours for something that should take much less than a second in C++). I am sure part of the problem lies in the way I wrote the code but I don't know what is spending most of my time. I looked at the list archives and there was mention of an profiling package for Mathematica but a)I can't find it & b)It may not work with Mathematica 4.*. My questions: 1. Any general suggestions on how to figure out which functions are taking most of the time? I guess I could manually have each function I am interested in monitoring keep a variable that counts the amount of CPU time that has been spent on it by doing something like: function[args_]:=Module[{},functionTimer+=Timing[ .... My actual function ..... ][[1]]] but it would very cumbersome to do this to all of the functions in my program and I am not sure I will get accurate results anyway. 2. Compiling functions is not always that easy. I did read the on-line docs and the archives and it does take some work to make a function compile usefully. Is there an FAQ or a tutorial somewhere? 3. Am I the only one who finds the lack of a profiler really really annoying ? Mathematica is powerful and it is usually easy to ask it to do what u want. The challenge a lot of times is doing so without taking too long. Thanks, Husain PS: One more quick one: Why does the front end act funny when I have the num lock turned on on Linux? (Linux,Athlon, KDE)