[MLton] commit r4134: fixed fix to getrusage bug
Stephen Weeks
MLton@mlton.org
Thu, 3 Nov 2005 10:18:09 -0800
> Fair enough, but I'd still prefer to see it automatically enabled
> when the Timer structure is used. It's rather odd behavior to not
> get the GC timing information unless the program is invoked with
> particular @MLton flags or using the MLton.GC structure. In
> particular, you can't write portable SML code that uses the Basis
> Library with predictible effects on multiple compilers.
Good point. Now that I understand the situation better, I'm happy
with your original solution, i.e. turning on rusageIsEnabled if
MLton.Rusage.rusage is used. Then, if people use Timer or
MLton.Rusage, they get the right behavior by default. Furthermore, if
they don't refer to them, they automatically get the speed benefit of
not measureing GC rusage. Finally, experts sill have
MLton.GC.setRusage at their disposal, to disable stuff for performance
if they want. For example, the line in MLton's main.fun will be
unchanged, and will do the right thing.
Make sense?
I wonder if "MLton.Rusage.measureGC" would be a better place/name than
"MLton.GC.setRusage", since that would put it closer to
MLton.Rusage.rusage, and so make it more likely that people would
notice it at the right time.