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

Improve inference for unique with abstract eltypes #36280

Merged
merged 1 commit into from
Jun 16, 2020
Merged

Conversation

timholy
Copy link
Member

@timholy timholy commented Jun 14, 2020

#20317 improved inference of unique, but problematic cases still arise for containers with known but abstract eltypes. Here, we short-circuit the typejoin when the return type is determined by the element type of the input container.

For unique(f, itr), this commit also allows the caller to supply seen::Set to circumvent the inference challenges.

This resolves a number of invalidations in Pkg and REPL.

TODO: update NEWS entry with issue number, once assigned.

@timholy timholy added the needs news A NEWS entry is required for this change label Jun 14, 2020
@timholy timholy removed the needs news A NEWS entry is required for this change label Jun 14, 2020
@timholy timholy added compiler:latency Compiler latency and removed compiler:latency Compiler latency labels Jun 14, 2020
base/set.jl Outdated Show resolved Hide resolved
#20317 improved inference of unique, but problematic cases still arise
for containers with known but abstract eltypes. Here, we short-circuit
the `typejoin` when the return type is determined by the element type
of the input container.

For `unique(f, itr)`, this commit also allows the caller to supply
`seen::Set` to circumvent the inference challenges.
@JeffBezanson JeffBezanson merged commit cde6268 into master Jun 16, 2020
@JeffBezanson JeffBezanson deleted the teh/unique branch June 16, 2020 17:31
@timholy timholy added the compiler:latency Compiler latency label Jun 27, 2020
timholy added a commit to JuliaLang/Pkg.jl that referenced this pull request Jun 30, 2020
JuliaLang/julia#36280 introduced the ability to
pre-allocate the container used to track values of `f.(itr)` in
`unique(f, itr)`. Particularly for containers with `Union` elements,
this circumvents significant inference problems.

Related: JuliaLang/julia#36454
timholy added a commit to JuliaLang/Pkg.jl that referenced this pull request Jun 30, 2020
JuliaLang/julia#36280 introduced the ability to
pre-allocate the container used to track values of `f.(itr)` in
`unique(f, itr)`. Particularly for containers with `Union` elements,
this circumvents significant inference problems.

Related: JuliaLang/julia#36454
simeonschaub pushed a commit to simeonschaub/julia that referenced this pull request Aug 11, 2020
JuliaLang#20317 improved inference of unique, but problematic cases still arise
for containers with known but abstract eltypes. Here, we short-circuit
the `typejoin` when the return type is determined by the element type
of the input container.

For `unique(f, itr)`, this commit also allows the caller to supply
`seen::Set` to circumvent the inference challenges.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:latency Compiler latency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants