[MLton-devel] MLton and profiling
Stephen Weeks
MLton@mlton.org
Mon, 10 Feb 2003 00:19:53 -0800
Thanks for all the feedback, Joe. It was very helpful.
> why doesn't MLton support a --version flag?
You can call "mlton -v" to find out the version number.
> My problem is functions like:
>
> function composition;
> fun ## (f,g) (x,y) = (f x, g y);
> fun total f x = SOME (f x) handle ERR _ => NONE;
>
> They all show up on the call graph as hugely important, with large
> numbers of called and caller functions, but I use these functions like
> simple macros to inline. [Sometimes just to improve the layout of code
> on the page: (f o g o h o j) x versus f (g (h (j x))).] I'm rather
> horrified at the thought that MLton might be treating them as
> functions instead of inlining them, but even if so I'd still like a
> way of suppressing them in the call graph.
Don't worry. MLton is certainly inlining them. You see a single node
in the call graph because the profiling infrastructure combines all of
the copies into a single graph node for reporting purposes. The
thinking at the time was to keep information related to the source,
which only had one ## function, and that the inlining (or duplication
for other reasons) was an implementation detail. However, I now think
that it is better to go the other way, and to keep whatever duplicates
the implementation creates separate. I have changed the profiling
infrastructure to do so. If I get requests from people for the old
combining behavior, I'll add a -coalesce switch to mlprof.
> Considering the function
>
> fun f n = (g o h) n;
>
> I believe at the moment this would be represented as a call from f to
> o, and a call from o to g and h. I'd much prefer this to be treated as
> a call from f to g and h. After all, I could insist on this simply by
> tweaking the code to be
>
> fun f n = g (h n);
>
> This is obviously a completely trivial example, but I hope you see my
> point.
Definitely. I've added a -ignore flag to mlprof that should let you
get what you want. Now you can do
mlprof -ignore 'o' z mlmon.out
to ignore all functions named 'o'. With -show-line true this becomes
mlprof -show-line true -ignore 'o .*' z mlmon.out
Since -ignore takes a regexp, you can use it with -show-line true to
ignore whole files or directories from your project.
There's a new experimental release of MLton, 20030209, at
http://www.mlton.org/experimental/
This release has the basis library fix for Word, as well as the
profiling improvements.
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel