[MLton-devel] eliminating HandlerPush/Pop

Stephen Weeks MLton@mlton.org
Fri, 10 Jan 2003 06:40:56 -0800


After encountering yet more annoyances with HandlerPush/Pop while
working on profiling, I decided to go ahead and put in a couple of
simple strategies for implementing handlers that do not require
HandlerPush/Pop.  I added a new flag, -handlers, and ran the
benchmarks in three ways.

MLton0 -- mlton -handlers pushpop
  the old way, using HandlerPush/Pop

MLton1 -- mlton -handlers simple
  insert appropriate statements before each call, raise, and return 

MLton2 -- mlton -handlers flow
  like -handlers simple, but with some simple forward dataflow
  analysis to eliminate redundant assignments 

Below are the benchmark results.  The upshot is that the three
approaches are very close (within 10%) in terms of both runtime and
size, with count-graphs seeing the biggest change in runtime and
lexgen and mlyacc (both automatically generated code) seeing the
biggest change in code size.  I'd say this is already a good enough
argument for eliminating HandlerPush/Pop.

run time ratio
benchmark         MLton1 MLton2
barnes-hut          1.00   1.01
boyer               1.02   1.04
checksum            0.99   0.99
count-graphs        0.92   0.91
DLXSimulator        1.00   1.00
fft                 1.00   1.00
fib                 0.99   1.06
hamlet              1.02   1.01
imp-for             1.00   1.00
knuth-bendix        1.03   1.05
lexgen              1.08   1.00
life                0.92   0.91
logic               0.96   0.96
mandelbrot          1.00   1.00
matrix-multiply     1.00   1.00
md5                 1.00   1.00
merge               1.00   1.00
mlyacc              1.00   1.00
model-elimination   1.00   1.00
mpuz                1.00   1.00
nucleic             1.00   1.00
peek                1.00   1.00
psdes-random        1.00   0.99
ratio-regions       1.00   0.98
ray                 1.02   0.98
raytrace            0.99   1.00
simple              1.01   0.99
smith-normal-form   1.00   1.00
tailfib             1.00   1.00
tak                 0.99   1.00
tensor              1.01   0.99
tsp                 1.00   1.00
tyan                1.01   1.00
vector-concat       0.99   1.01
vector-rev          1.00   1.00
vliw                1.01   1.01
wc-input1           1.00   1.01
wc-scanStream       1.00   1.02
zebra               0.99   0.99
zern                1.00   1.00
size
benchmark            MLton0    MLton1    MLton2
barnes-hut          115,777   115,521   115,073
boyer               138,712   139,128   139,000
checksum             49,592    49,608    49,608
count-graphs         67,456    68,232    68,056
DLXSimulator        106,169   106,249   105,913
fft                  58,316    58,332    58,332
fib                  49,632    49,664    49,616
hamlet            1,235,849 1,242,185 1,234,889
imp-for              49,600    49,616    49,616
knuth-bendix         90,649    91,801    90,793
lexgen              169,638   170,790   162,070
life                 69,592    69,720    69,576
logic               110,960   110,976   110,960
mandelbrot           49,736    49,736    49,736
matrix-multiply      50,160    50,176    50,176
md5                  58,457    58,537    58,505
merge                50,952    50,968    50,968
mlyacc              513,062   503,190   482,838
model-elimination   607,913   615,001   605,209
mpuz                 54,552    54,584    54,584
nucleic             196,968   197,000   196,984
peek                 56,417    56,545    56,481
psdes-random         50,344    50,360    50,360
ratio-regions        68,008    68,136    68,056
ray                 110,937   111,529   110,345
raytrace            282,454   285,110   284,742
simple              198,884   204,260   192,644
smith-normal-form   190,341   190,373   190,277
tailfib              49,408    49,424    49,424
tak                  49,776    49,824    49,808
tensor              113,748   113,620   112,820
tsp                  63,585    63,601    63,521
tyan                110,105   110,713   109,737
vector-concat        50,760    50,776    50,776
vector-rev           49,968    49,984    49,984
vliw                323,570   327,778   321,858
wc-input1            71,222    71,406    71,230
wc-scanStream        71,950    72,158    71,982
zebra               122,641   122,881   122,433
zern                 55,491    55,507    55,507


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