-
Notifications
You must be signed in to change notification settings - Fork 18
Why is MLton so slow, again? #437
Comments
Do you have a particular commit that triggers the slow compile? |
@MatthewFluet I tried to pin down the change that triggered the slow compile but did not have any conclusive finding. |
@MatthewFluet Is there something I can do to pin down the cause? I suspect it's because of the introduction of
|
If the slowdown was all in a single pass, then we can usually work out a reason. But, if it is just generally slower throughout the compilation, or just within the native codegen, then it is a lot harder to pin down. I wouldn't expect the introduction of a datatype to have significant effect; perhaps you changed the datatype from a unary tycon to a binary tycon and are worried that it has caused blowup in monomorphisation? But, that would probably manifest as slowdown throughout the compilation, since the monomorphisation happens very early in the compilation. What I saw previously, mentioned in MLton/mlton#196, was some huge case dispatches, which just led to massive numbers of basic blocks in some functions which seemed to be bad (for both the native codegen and for the C codegen). |
@MatthewFluet Thanks. Yes, I was worried about blowup in monomorphisation. Essentially it was changed from |
For what it's worth, whatever configuration is triggered when we do the profiling build seems to go much faster than the ordinary build (try |
Is it possible to skip almost all the optimization (on travis)? I am not sure how to do that from the help message of |
You can use It would be a nice project to develop a good "-O0" collection of passes that make a good tradeoff in compile time and run time. |
That's curious about profiling leading to faster builds --- usually the addition of profiling code into the program inhibits optimizations and slows things down. |
It's very strange indeed! The build goes about 15x faster with profiling turned on. The built code itself is a bit slower of course... |
So... the conclusion right now is to enable profiling on travis to speed up the compilation? |
BTW @MatthewFluet I tried running MLton with
Any idea what might cause that? Or maybe there is some better more finely-tuned collection of passes I should drop. |
|
@MatthewFluet Ahh, that explains it 😄 |
Attached are the And, here is the comparison on a simple hello-world program:
Without any optimizations, the program takes 5X longer to compile and runs for more than 45min (yes 45min!) and uses 35G (yes, 35G!) heap, at which point we are GC thrashing and I killed it. |
Closes RedPRL#437 MLton's `polyvariance` optimization duplicates small higher-order functions. One (unresolved, though usually not significant) issue is that polyvariance can duplicate code local to a function, even if it doesn't depend on the higher-orderness (see http://www.mlton.org/pipermail/mlton-devel/2002-January/021211.html). This seems consistent with the discussion at MLton/mlton#136.
Closes RedPRL#437 MLton's `polyvariance` optimization duplicates small higher-order functions. One (unresolved, though usually not significant) issue is that polyvariance can duplicate code local to a function, even if it doesn't depend on the higher-orderness (see http://www.mlton.org/pipermail/mlton-devel/2002-January/021211.html). This seems consistent with the discussion at MLton/mlton#196.
Closes #437 MLton's `polyvariance` optimization duplicates small higher-order functions. One (unresolved, though usually not significant) issue is that polyvariance can duplicate code local to a function, even if it doesn't depend on the higher-orderness (see http://www.mlton.org/pipermail/mlton-devel/2002-January/021211.html). This seems consistent with the discussion at MLton/mlton#196.
During the development of immortal lines (#431), somehow MLton became unhappy again. I wonder whether it is due to the use of the new polymorphic datatypes.
The text was updated successfully, but these errors were encountered: