Skip to content
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

Collect rules with Appendable_list.t instead of Id.Map.t #9057

Closed
wants to merge 8 commits into from

Conversation

pmwhite
Copy link
Collaborator

@pmwhite pmwhite commented Oct 31, 2023

Based on #9050, the main goal is to replace the unioning of a bunch of maps with what I expect to be a cheaper operation. I've benchmarked a similar patch on Jane Street's code base and saw enough improvement to think that this is a worthwhile refactor. My thinking was to have review done first here on GitHub; once it is able to be merged I'll import it, run benchmark it again and report back with a summary of the results.

rgrinberg and others added 8 commits October 31, 2023 14:12
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
Signed-off-by: Philip White <code@trailingwhite.space>
Signed-off-by: Philip White <code@trailingwhite.space>
The hypothesis is the unioning maps together is somewhat expensive and
isn't necessary, since the maps are always disjoint. Instead, we just
concatenate lists together.

Signed-off-by: Philip White <code@trailingwhite.space>
Signed-off-by: Philip White <code@trailingwhite.space>
@pmwhite
Copy link
Collaborator Author

pmwhite commented Oct 31, 2023

It's probably not worth reviewing until #9050 gets merged, so that the diff in this PR isn't as large. I wish GitHub knew how to handle PR chains.

@snowleopard snowleopard requested a review from rgrinberg October 31, 2023 21:04
@pmwhite pmwhite marked this pull request as draft October 31, 2023 21:16
@pmwhite
Copy link
Collaborator Author

pmwhite commented Oct 31, 2023

Converting to draft because I was silly and forgot to run tests, which are broken.

@Alizter
Copy link
Collaborator

Alizter commented Oct 31, 2023

The bench shows some very promising results!

Metric Last PR value Last main value Delta
[Clean Sandbox] Build Time 299.965 316.930 -5.35289%
[Clean] Build Time 298.799 310.847 -3.87600%
[Null Sandbox] Build Time 3.58720 3.63885 -1.41939%
[Null] Build Time 3.57499 3.66382 -2.42454%

@Alizter
Copy link
Collaborator

Alizter commented Oct 31, 2023

However it seems there are times when the union is eliminating duplicates:

/odoc-wrapped-lib.t/run.t
   $ dune build @doc
+  Error: Multiple rules generated for
+  _build/default/_doc/_html/l/index.html.json:
+  - <internal location>
+  - <internal location>
+  -> required by alias doc
+  [1]

I wonder if these can be resolved by not duplicating them to begin with. 🤔

@pmwhite
Copy link
Collaborator Author

pmwhite commented Nov 1, 2023

@Alizter Awesome, thanks for the benchmark results! Regarding the test failures, some of them are just re-orderings of rules, which is expected.

Other failures, like the one you highlighted, replace one error message with another. I suspect that the duplicate rules error message isn't new, but has just been hidden by the first error message - the re-ordering of rules changed which one actually gets displayed. Notice that the error you pointed out is very similar to #1645 , which is yet to be fixed.

@rgrinberg
Copy link
Member

@pmwhite please re-open once you make some progress on this

@rgrinberg rgrinberg closed this Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants