[MLton-devel] flattening

Matthew Fluet fluet@CS.Cornell.EDU
Thu, 16 Jan 2003 12:07:06 -0500 (EST)


I'm concerned about the SSA flattening pass having a negative impact on
allocation performance.  I was profiling
wc-scanStream.sml and I noticed that the input1 function in
<basis>/io/stream-io.fun was allocates about 90Gb.  That averages 330
bytes per input of one char.

Now, as a first step, I changed the instream datatype from:
      datatype instream = In of {reader: reader,
	 	                 augmented_reader: reader,
			         tail: state ref ref},
				 state: state ref}
to
      datatype instream = In of {common: {reader: reader,
					  augmented_reader: reader,
					  tail: state ref ref},
				 state: state ref}

because every time through input1, I call updateState (is, next)
which changed from
      fun updateState (In {reader, augmented_reader, tail, ...}, state) =
	In {reader = reader,
	    augmented_reader = augmented_reader,
	    tail = tail,
	    state = state}
to
      fun updateState (In {common, ...}, state) =
	In {common = common,
	    state = state}

Now, I was hoping to cut at least some of the allocation by not
reallocating three elements of the tuple.  But, I get exactly the same
allocation behavior.  I assume this is due to flattening.  Is this a
reasonable assumption?  Is this "ok" behavior of flattening?




-------------------------------------------------------
This SF.NET email is sponsored by: Thawte.com
Understand how to protect your customers personal information by implementing
SSL on your Apache Web Server. Click here to get our FREE Thawte Apache 
Guide: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0029en
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel