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

TypeMap: Cease trying to guarantee sorting #32776

Merged
merged 7 commits into from
Aug 16, 2019
Merged

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Aug 3, 2019

We've found it can be hard to maintain specificity ordering linearly of method dispatch (c.f. #30171), this instead just embraces that and explicitly doesn't care and just adds an extra list to keep track of any inconsistencies. It turns out that seems to look a lot like our existing ambiguity analysis code! Plus, it'll hopefully mean we can make some easy speculative optimizations to the TypeMap which will hopefully make it faster to load code (#15048, #21760, #16418).

Closes #32747
Closes #29594

@JeffBezanson
Copy link
Member

Would be good to get some before and after package loading times.

handle accidental cycles in the TypeMap->next list,
and handle forward refernces in TypeMap->prev without excessive printing
relax the check here to more closely match the comment
addresses an issue where we might be find an ambiguity with badly designed methods,
such as the ambiguous Nothing/Missing rules (cf #31602)
@vtjnash
Copy link
Member Author

vtjnash commented Aug 16, 2019

We don't expect this to make much difference (as seen below), since it does roughly the same amount of work, and just does it more correctly. It does however gives us more tools to do so in the future, as well as prepares us to fix a threading race condition.

on master:

$ ./julia -q
julia> @time using DataFrames
[ Info: Recompiling stale cache file /home/vtjnash/.julia/compiled/v1.3/DataFrames/AR9oZ.ji for DataFrames [a93c6f00-e57d-5684-b7b6-d8193f3e46c0]
 17.232868 seconds (2.40 M allocations: 133.970 MiB, 0.18% gc time)

$ ./julia -q
julia> @time using DataFrames
  0.879511 seconds (1.30 M allocations: 81.718 MiB)

on PR:

$ ./julia -q
julia> @time using DataFrames
[ Info: Recompiling stale cache file /home/vtjnash/.julia/compiled/v1.3/DataFrames/AR9oZ.ji for DataFrames [a93c6f00-e57d-5684-b7b6-d8193f3e46c0]
 16.930647 seconds (2.43 M allocations: 136.471 MiB, 0.47% gc time)

$ ./julia -q
julia> @time using DataFrames
  0.897301 seconds (1.38 M allocations: 86.582 MiB)

@vtjnash vtjnash force-pushed the jn/typemap-unsorting branch from e866576 to 39c81e8 Compare August 16, 2019 02:51
@JeffBezanson
Copy link
Member

Ok, that's great. I didn't expect a significant change, but good to sanity check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types and dispatch Types, subtyping and method dispatch
Projects
None yet
2 participants