With MLton and mlprof, you can profile your program to find out bytes allocated, execution counts, or time spent in each function. To profile you program, compile with -profile kind, where kind is one of alloc, count, or time. Then, run the executable, which will write an mlmon.out file when it finishes. You can then run mlprof on the executable and the mlmon.out file to see the performance data.
Here are the three kinds of profiling that MLton supports.