-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
ExtractDependencies uses more efficient caching #18403
Conversation
test performance with #sbt please |
performance test scheduled: 1 job(s) in queue, 1 running. |
Performance test finished successfully: Visit https://dotty-bench.epfl.ch/18403/ to see the changes. Benchmarks is based on merging with main (ca6a80e) |
test performance with #sbt please |
performance test scheduled: 1 job(s) in queue, 0 running. |
v = v1 | ||
update(key, v1) | ||
v.uncheckedNN | ||
// created by blending lookup and update, avoid having to recompute hash and probe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if missed something, but it looks like HashMap
and EqHashMap
both inherit from the GenericHashMap
and override this method with exactly the same code? Is there a reason for this, or could the duplication be reduced? 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was done just because all the other methods are duplicated in EqHashMap, so this one calls the overrides - one could compare but I would assume the original reason still stands
Performance test finished successfully: Visit https://dotty-bench.epfl.ch/18403/ to see the changes. Benchmarks is based on merging with main (ca6a80e) |
@sjrd asking for your review now 🎖️ |
alternative to #18219
reduces allocations in the phase by 77% (on
scala3-compiler-bootstrapped
), allocations in the whole compilation pipeline are reduced from about 12% to 4% contributed by this phase.Reduced allocations come from:
seen
cache.ClassDependency
allocation each time a dependency exists (many are likely duplicated)performance is also improved due to less expensive hashing (
EqHashMap
), and introduction ofEqHashSet
, also reducing number of times we hash (add
method on HashSet, and optimisedgetOrElseUpdate
). Probably also from reduced heap pressure of allocating.heap before:
heap after:
As you can see now the majority of allocation is by Zinc (MappedFileConverter)