-
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
Cache all memberNamed results #9633
Conversation
Back of the envelope calculation for memory sizes. All numbers for typer/*.scala with Stats enabled, so numbers are a bit higher than without. We have 174K computeNonPrivateMembersNamed Caches: 4657 ArrayTables Small TableSizes: size #tables 0 1532 Total entries in ArrayTables: 13788. This leaves ~160K entries in HashTables. So member accesses are spread out very unevenly. The majority is in relatively few large tables. Largest 5 table sizes: 4079, 4045, 2353, 1443, 1400. Then there are 20 or so between 1000 and 1300. I suspect the two Size overhead: ArrayTables: 4657 * 88 bytes = 410K, or 30 bytes per used entry Previous solution with LRU caches: 5950 caches * 176 bytes ~ 1M Bottom line: we get a 3x improvement in cache hit rate (from 92.5% to 97.5%) for a 5x increase in memory (1M -> 5.2M). |
test performance please |
performance test scheduled: 2 job(s) in queue, 1 running. |
Downstream improvement: # allocated AsSeenFromMap goes from 124572 to 93616 |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/9633/ to see the changes. Benchmarks is based on merging with master (c908b13) |
test performance please |
performance test scheduled: 4 job(s) in queue, 1 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/9633/ to see the changes. Benchmarks is based on merging with master (0246f72) |
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.
LGTM
907f7a0
to
cf6531d
Compare
test performance please |
@nicolasstucki Can you help me debug the idempotency failure here? In particular, is there a way to repeoduce this in a standalone test? I cannot reproduce the failure locally, it's CI only. |
performance test scheduled: 1 job(s) in queue, 1 running. |
00d16ac
to
bc1eaf3
Compare
Use a full cache instead of an LRU cache. For `typer/*.scala`, this reduced computed member searches on normal ClassDenotations from 520K to 170K. Cache hit rate improves to 97.5%, from 92.5%. (Without member caching there are almost 7Mio computed members for the same code base).
The two implementation classes of LinearTable had so much in common that they could be combined. Since the implementation is now fixed, we can use the usual mutable interface for a table.
When going from dense to hashed, we should expand by a multiple greater than two, or we will have to reallocate immediately afterwards.
bc1eaf3
to
53961f3
Compare
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/9633/ to see the changes. Benchmarks is based on merging with master (a036b70) |
The recent deterioration is due to parallel position pickling being disabled now. |
Use a full cache instead of an LRU cache. For
typer/*.scala
, thisreduced computed member searches on normal ClassDenotations from 520K to
170K. Cache hit rate improves to 97.5%, from 92.5%. (Without member caching
there are almost 7Mio computed members for the same code base).