[MLton-user] Profiling - Sequence.append

Stephen Weeks MLton-user@mlton.org
Mon, 4 Oct 2004 19:09:10 -0700


> I've got some quadratic or worse behavior somewhere in my code with
> regard to execution times.
> 
> Profile shows >40% in Sequence.append
> 
> Suspects are numerous.  Looking for insight on what types of operations
> are entailed in Sequence.append?
> 
> List appends?

No.

> String concats?  

Yes.  You may find mlton -show-def-use useful in tracking down where
certain functions are used.  I used it to answer your question :-).

As to finding your hot code, I recommend compiling with -profile-stack
true and seeing which of your functions are on the stack for the
majority of the time.  You could try looking at the dot call graph as
well.  It's often easy to start at the root and follow the hot
functions down to the problem.  mlprof -gray true is also useful for
this.