-
Notifications
You must be signed in to change notification settings - Fork 413
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
Performance regression after #8447 #9738
Comments
Here are some
And a few screenshots, there are quite some differences between both, they seem to be concentrated in the rule loading stage:
|
Simplest thing you could do to mitigate this, is to speed up the comparison of dune file ast's by including a checksum inside the dune file data structure. See |
@rgrinberg the slowdown seems pretty consequential (100% slower in no-op builds); is the reason for the slowdown understood? was a slowdown expected as a consequence of #8447? |
Somewhat of a slowdown as expected. The reason is understood. #8447 relies a lot more on the comparisons of dune files which is slow. We already rely on this comparison elsewhere so I thought it wouldn't make much of a difference. Tbh, it's probably not a huge issue anyway. Incremental build performance for workspaces that large is pretty hopeless without the watch mode. I'm more interested in improving the watch mode to make it usable for more people, but of course I'll accept whatever optimizations people for 0 builds. |
For what is worth, I tested LexiFi's codebase: a noop build went from 2.8s (with Dune 3.8) to 3.6s (with a version not very far from the current |
Get rid of the slow dune file comparison in #9738 Signed-off-by: Rudi Grinberg <[email protected]> <!-- ps-id: 6499de7c-e597-44e0-af7f-33bf7bf235ab -->
Get rid of the slow dune file comparison in #9738 Signed-off-by: Rudi Grinberg <[email protected]> <!-- ps-id: 6499de7c-e597-44e0-af7f-33bf7bf235ab -->
Get rid of the slow dune file comparison in #9738 Signed-off-by: Rudi Grinberg <[email protected]> <!-- ps-id: 6499de7c-e597-44e0-af7f-33bf7bf235ab -->
Get rid of the slow dune file comparison in #9738 Signed-off-by: Rudi Grinberg <[email protected]> <!-- ps-id: 6499de7c-e597-44e0-af7f-33bf7bf235ab -->
Get rid of the slow dune file comparison in #9738 Signed-off-by: Rudi Grinberg <[email protected]> <!-- ps-id: 6499de7c-e597-44e0-af7f-33bf7bf235ab -->
Get rid of the slow dune file comparison in #9738 Signed-off-by: Rudi Grinberg <[email protected]>
Fixed in #9769. |
It is a huge issue. Watch mode just doesn’t cut it for now. There are multiple things that dune do not handle and require staged compilation for example. And the lock just blocks too many operations that require to stop the watch mode. Such a slow down also makes watch mode much more troublesome to use because it takes longer to start. |
All of those facts point to improving the watch mode. We've fixed the regression but a 0 build is still 20 seconds and optimizing it beyond that would require a lot of work. On the other hand, improving the watch mode is fairly straightforward. |
Get rid of the slow dune file comparison in ocaml#9738 Signed-off-by: Rudi Grinberg <[email protected]>
* refactor: rename [Dune_load.conf] to [Dune_load.t] (#9766) Signed-off-by: Rudi Grinberg <[email protected]> * refactor: Make [Dune_load.t] abstract (#9767) Signed-off-by: Rudi Grinberg <[email protected]> * refactor: move [Dune_load.Dune_files.in_dir] (#9768) It doesn't need to be in the [Dune_files] submodule Signed-off-by: Rudi Grinberg <[email protected]> * fix: performance regression from #8447 (#9769) Get rid of the slow dune file comparison in #9738 Signed-off-by: Rudi Grinberg <[email protected]> --------- Signed-off-by: Rudi Grinberg <[email protected]> Co-authored-by: Rudi Grinberg <[email protected]>
CHANGES: - Fix performance regression for incremental builds (ocaml/dune#9769, fixes ocaml/dune#9738, @rgrinberg) - Fix `dune ocaml top-module` to correctly handle absolute paths. (ocaml/dune#8249, fixes ocaml/dune#7370, @Alizter) - subst: ignore broken symlinks when looking at source files (ocaml/dune#9810, fixes ocaml/dune#9593, @emillon) - subst: do not fail on 32-bit systems when large files are encountered. Just log a warning in this case. (ocaml/dune#9811, fixes ocaml/dune#9538, @emillon) - boot: sort directory entries in readdir. This makes the dune binary reproducible in terms of filesystem order. (ocaml/dune#9861, fixes ocaml/dune#9794, @emillon)
CHANGES: - Fix performance regression for incremental builds (ocaml/dune#9769, fixes ocaml/dune#9738, @rgrinberg) - Fix `dune ocaml top-module` to correctly handle absolute paths. (ocaml/dune#8249, fixes ocaml/dune#7370, @Alizter) - subst: ignore broken symlinks when looking at source files (ocaml/dune#9810, fixes ocaml/dune#9593, @emillon) - subst: do not fail on 32-bit systems when large files are encountered. Just log a warning in this case. (ocaml/dune#9811, fixes ocaml/dune#9538, @emillon) - boot: sort directory entries in readdir. This makes the dune binary reproducible in terms of filesystem order. (ocaml/dune#9861, fixes ocaml/dune#9794, @emillon)
While testing most recent commits from
main
I noticed that noop builds were sustantially slower in the last weeks.After dissecting for the past few months, I could pin down to commit 9105a43, from #8447, cc @rgrinberg @Alizter as PR author and reviewer.
The regression makes the noop build in Ahrefs case almost 2x slower:
All other things in the measurements above are equal. I am building the dune exe using
dune build bin/main.exe
and calling the exe directly as shown in thetime
commands above.I will investigate more tomorrow to see if I can identify which particular rules are slowing down, in case there are any other info I can provide, please lmk.
The text was updated successfully, but these errors were encountered: