[MLton-devel] MLton and profiling

Joe Hurd MLton@mlton.org
Mon, 10 Feb 2003 18:57:08 +0000 (GMT)


On Mon, 10 Feb 2003, Stephen Weeks wrote:

> You can call "mlton -v" to find out the version number.

Oops, should have tried that. Since it wasn't listed as an option when
I typed 'mlton', I didn't think it was allowed.

> 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.

I certainly prefer it the way it is now. I notice that there's still
only one node for the 'o' function, which would be confusing, but
since it's the first on the list of ignored functions it doesn't
matter at all. Incidentally, dot seems to prefer it this way too,
because the call-graph seems to me to be a lot more visually
appealing.

I have only one major gripe with the source-level profiling. I write a
lot of functions in this style:

fun sort cmp =
  let
    val m = merge cmp
    fun f [] = []
      | f (xs as [_]) = xs
      | f xs = let val (l, r) = split xs (length xs div 2) in m (f l) (f r) end
  in
    f
  end;

The function name as it appears in the profile is 'f', but of course
I would prefer it to be 'sort'. Similarly, a function with no name in
the profiling turns out to be the anonymous function in

fun obj_order ({literal_order = false, ...} : parameters) _ _ c = c
  | obj_order {literal_order = true, tracking, ...} x ys c =
  foldl (fn (y,c) => if x = y then c else tm_order tracking x y c) c ys;
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

It would be a lot more helpful to list this as 'obj_order'. There are
so many occurrences like this that it's easy to get lost looking at a
call graph. Function 'f' calls function 'h' calls function 'f' etc.
They all have line numbers so in principle I could go and look at the
source, but in practice it seems too much work for non-bottleneck
areas.

I guess I'm asking to print the name of the top-level function
surrounding the source line in question. If you think this might be
potentially confusing, then perhaps there could be an option that
would have the existing behaviour as default?

Regards,

Joe



-------------------------------------------------------
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