Avoid re-marking ephemerons with trivial data - #13827
Merged
Merged
Conversation
Contributor
Will do. |
Contributor
Full GC logs corresponding to 5.3.0 and this PR, with timings (in s): GC-full-530.txt -> 11.7287089825 By comparison, the 4.14 time is 6.33123278618. |
NickBarnes
approved these changes
Feb 25, 2025
NickBarnes
left a comment
Contributor
There was a problem hiding this comment.
Code is correct; naming quibbles.
In general, ephemerons may need to be marked more than once, if new marking has occurred since ephemeron marking began. This patch optimises this logic: re-marking is never necessary if the data field of the ephemeron is trivial. This optimisation was present in OCaml 4, and is important for Stdlib.Weak, which only uses ephemerons with trivial data.
stedolan
force-pushed
the
unremarkable-ephemerons
branch
from
February 25, 2025 12:55
99925bb to
2a06c10
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In general, ephemerons may need to be marked more than once, if new marking has occurred since ephemeron marking began. This patch optimises this logic: re-marking is never necessary if the data field of the ephemeron is trivial. This optimisation was present in OCaml 4, and is important for Stdlib.Weak, which only uses ephemerons with trivial data.
This means that programs using
Weakwill only do one pass over the ephemeron set, since the ephemerons backing weak tables will be removed from the todo list once they are scanned.cc @nojb who's interested in testing this: could you report the
OCAMLRUNPARAM=v=0xfffGC logs on your test case before and after this patch, as well as timings?