[MLton-devel] cvs commit: self-compile improvements using the profiler
Stephen Weeks
sweeks@users.sourceforge.net
Tue, 28 Jan 2003 21:33:59 -0800
sweeks 03/01/28 21:33:59
Modified: mlton/codegen/x86-codegen x86-allocate-registers.fun
Log:
This checkin fixes one recently introduced performance problem that
has been especially noticeable on self compiles. The problem was
introduced on December 16, which was the same time as I was doing a
large checkin of profiling code. So, I had thought that the profiling
stuff was responsible. Turns out that had nothing to do with it. The
problem was due to a couple of innocuous-looking asserts that had been
added -- the RegisterAllocation.toString call was costing quite a bit,
and happened even though the asserts didn't.
Before this checkin a self-compile had the following performance.
MLton finished in 445.61 + 374.75 (46% GC)
total allocated: 69,855,314,616 bytes
And afterwards, here was the performance.
MLton finished in 318.05 + 199.32 (39% GC)
total allocated: 37,234,766,632 bytes
Not yet down where we used to be (under 240s total), but a lot
better.
The new profiling tools were incredibly helpful in finding this
problem, especially the new -graph option, which let me zero in on the
relevant parts of the call graph. The mlprof call that finally did
the trick was:
mlprof -graph '(pred "x86-allocate-registers.fun: 794")' \
-show-line true \
mlton-compile mlmon.out
This led me to the following graph, which once I looked at the code a
little, helped me to see the problem. Anyways, this has been a nice
demonstration to me of the ease of use and utility of the profiling
tools, even on a very large program. It also makes me think there is
a lot more that could be done, especially with the call graphs and
program understanding and debugging.
digraph "call-stack graph" {
label = "call-stack graph"
n0 [shape = "box", label = "chooseRegister\ncodegen/x86-codegen/x86-allocate-registers.fun: 1308\n0.0% 1.5% 0.0%\n"]
n0 -> n1 []
n2 [shape = "box", label = "spillAndReissue\ncodegen/x86-codegen/x86-allocate-registers.fun: 1257\n"]
n2 -> n1 []
n3 [shape = "box", label = "pre\ncodegen/x86-codegen/x86-allocate-registers.fun: 3830\n0.3% 24.4% 0.0%\n"]
n3 -> n1 []
n4 [shape = "box", label = "post\ncodegen/x86-codegen/x86-allocate-registers.fun: 4046\n0.3% 27.6% 0.0%\n"]
n4 -> n1 []
n1 [shape = "box", label = "toString\ncodegen/x86-codegen/x86-allocate-registers.fun: 794\n0.0% 44.0% 0.0%\n"]
n5 [shape = "box", label = "codegen/x86-codegen/x86-allocate-registers.fun: 10747\n0.2% 60.6% 0.0%\n"]
n5 -> n4 []
n5 -> n1 []
}
Revision Changes Path
1.27 +14 -6 mlton/mlton/codegen/x86-codegen/x86-allocate-registers.fun
Index: x86-allocate-registers.fun
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/codegen/x86-codegen/x86-allocate-registers.fun,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- x86-allocate-registers.fun 21 Jan 2003 22:56:03 -0000 1.26
+++ x86-allocate-registers.fun 29 Jan 2003 05:33:58 -0000 1.27
@@ -3839,9 +3839,13 @@
registerAllocation: t}
= let
val ra = registerAllocation
- val _ = Assert.assert
- ("pre: " ^ (toString ra),
- fn () => unique ra)
+ val _ =
+ if true
+ then ()
+ else
+ Assert.assert
+ ("pre: " ^ (toString ra),
+ fn () => unique ra)
val dead_memlocs = dead
val commit_memlocs = commit
@@ -4057,9 +4061,13 @@
registerAllocation: t}
= let
val ra = registerAllocation
- val _ = Assert.assert
- ("post: " ^ (toString ra),
- fn () => unique ra)
+ val _ =
+ if true
+ then ()
+ else
+ Assert.assert
+ ("post: " ^ (toString ra),
+ fn () => unique ra)
val (final_uses_registers,
final_defs_registers,
-------------------------------------------------------
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