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

ambiguity detection: more optimal code order #48846

Merged
merged 1 commit into from
Mar 4, 2023
Merged

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Mar 1, 2023

This can dramatically improve the computational effort for queries with a lot of resolved ambiguities (and will change the result of these). Those can occasionally happen for cases where Type{Union{}} is a part of the result, but where this is also an explicit method defined, such as this eltype query:

julia> @time Base._methods_by_ftype(Tuple{typeof(eltype), Type{A} where A<:(NamedTuple{names, T} where T<:Tuple where names)}, -1, Base.get_world_counter())
# master
  0.009458 seconds (12.56 k allocations: 414.719 KiB) # 25 results, scales badly with number of packages loaded
# PR
  0.001323 seconds (1.97 k allocations: 82.312 KiB) # 2 results, unaffected by number of packages loaded

This can dramatically improve the computational effort for queries with
a lot of resolved ambiguities (and will change the result of these).
Those can occasionally happen for cases where Type{Union{}} is a part of
the result, but where this is also an explicit method defined, such as
this eltype query:

```
julia> @time Base._methods_by_ftype(Tuple{typeof(eltype), Type{A} where A<:(NamedTuple{names, T} where T<:Tuple where names)}, -1, Base.get_world_counter())
```
@vtjnash vtjnash added the compiler:latency Compiler latency label Mar 1, 2023
@vtjnash vtjnash requested a review from topolarity March 1, 2023 19:40
@vtjnash vtjnash added the needs pkgeval Tests for all registered packages should be run with this change label Mar 1, 2023
@vtjnash
Copy link
Member Author

vtjnash commented Mar 3, 2023

@nanosoldier runtests()

@vtjnash vtjnash added merge me PR is reviewed. Merge when all tests are passing and removed needs pkgeval Tests for all registered packages should be run with this change labels Mar 3, 2023
@nanosoldier
Copy link
Collaborator

Your package evaluation job has completed - possible new issues were detected.
A full report can be found here.

@vtjnash
Copy link
Member Author

vtjnash commented Mar 4, 2023

Some interesting failures there to look into, but nothing that seems related

@vtjnash vtjnash merged commit ff5bd4b into master Mar 4, 2023
@vtjnash vtjnash deleted the jn/ambig-noambig branch March 4, 2023 18:29
@vtjnash vtjnash added minor change Marginal behavior change acceptable for a minor release backport 1.9 Change should be backported to release-1.9 and removed merge me PR is reviewed. Merge when all tests are passing labels Mar 6, 2023
KristofferC pushed a commit that referenced this pull request Mar 7, 2023
@KristofferC KristofferC mentioned this pull request Mar 7, 2023
52 tasks
@KristofferC KristofferC removed the backport 1.9 Change should be backported to release-1.9 label Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:latency Compiler latency minor change Marginal behavior change acceptable for a minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants