New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slower compilation 4.07 => 4.08 #8776
Comments
4.08.0:
|
I think at least some of this might be coming from the calls to |
Am not sure, if I didn't make a mistake, the same slowdown (worse in fact) can be obtained without any pattern matching at all: let n2 = 200
let n3 = 40
let () =
let f () =
for j = 1 to n2 do
Printf.printf "method f%i = ()\n" j
done
in
for i = 1 to n3 do
Printf.printf "let a%i = object\n" i;
f ();
Printf.printf "end\n"
done |
@nojb I see the same degradation in the same function with your second example (indeed it seems worse too). |
|
Looks like |
Or it could just not do the copy: it's only there to update the level so the expansion won't fail. But we could also have a version of the expansion that doesn't check the levels (we're past typechecking at this point, so all this doesn't matter anymore) |
I confirm that not calling correct_levels removes a good part of the observed slowdown. The call to correct_levels was there already in the first version of typeopt.ml (ea8fe59#diff-5ad81800134284c48d42f76b958990b3), but it is called much more often now, so it is worth optimizing it. My understanding is that, if we don't introduce a variant of the expansion that ignores levels, not calling correct_levels can only miss some optimizations (but not fail); is that right? |
That sounds right yes. |
That's right, but when an optimisation was missed would be very unpredictable and depend on things like if |
Any news on this issue before the release of |
To my best knowledge the answer is "no". (But I would be surprised if that was the cause of the +164% increase reported #8811, which we also don't know.) |
@alainfrisch Would you like to bring this PR to a conclusion? |
(This is an issue, not a PR.) Reading the discussion again, it seems the slowdown is confirmed, and some possible improvements that could improve performance significantly have been identified but not implemented. Unless I missed something, it sounds reasonable to keep the issue open. |
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc. |
I can reproduce the slowdown for recent versions of OCaml:
|
This is to document one case of significant degradation in compilation time between 4.07 and 4.08, on a synthetic example (originally created to stress-tess #8774). In case someone wants to investigate further...
Results:
Reproduction:
After a
make world
, run:with gen.ml:
The text was updated successfully, but these errors were encountered: