Avoid name table pollution with fresh existentials#5506
Merged
adriaanm merged 1 commit intoscala:2.12.xfrom Nov 30, 2016
Merged
Avoid name table pollution with fresh existentials#5506adriaanm merged 1 commit intoscala:2.12.xfrom
adriaanm merged 1 commit intoscala:2.12.xfrom
Conversation
During large compilations runs, the large numbers of globally unique fresh names for existentials captured from prefixes of `asSeenFrom`. is a) somewhat wasteful (all these names are interned in the name table) , and, b) form a pathological case for the current implementation of `Names#hashValue`, which leads to overfull hash-buckets in the name table. `hashValue` should probably be improved, but my attempts to do so have shown a small performance degradation in some benchmarks. So this commit starts by being more frugal with these names, only uniquely naming within an `asSeenFrom` operation. References scala/scala-dev#246
b2c3a5d to
44dac96
Compare
Member
Author
|
Review by @adriaanm |
Member
|
we could create a small class to encapsulate the variable |
adriaanm
reviewed
Nov 16, 2016
| // just err on the conservative side, i.e. with a bound that is too high. | ||
| // if(!(tparam.info.bounds contains tparam)) //@M can't deal with f-bounds, see #2251 | ||
| capturedParamIds += 1 | ||
| val capturedParamId = capturedParamIds |
Contributor
There was a problem hiding this comment.
What's the intent of the val? Is there some capture that this is avoiding? (I'm not seeing one.)
Contributor
|
I'm okay to merge as-is and come back and polish later. |
Contributor
|
LGTM |
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.
During large compilations runs, the large numbers of globally unique
fresh names for existentials captured from prefixes of
asSeenFrom.is a) somewhat wasteful (all these names are interned in the name table)
, and, b) form a pathological case for the current implementation of
Names#hashValue, which leads to overfull hash-buckets in the name table.hashValueshould probably be improved, but my attempts to do so haveshown a small performance degradation in some benchmarks. So this commit
starts by being more frugal with these names, only uniquely naming
within an
asSeenFromoperation.References scala/scala-dev#246