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 instanceof_tfunc to take declared parameter bounds into account #33472

Merged
merged 1 commit into from
Oct 5, 2019

Conversation

JeffBezanson
Copy link
Member

This fixes the following inference performance issue identified by @andreasnoack :

julia> using DataFrames

julia> @time cumsum(rand(2, 2), dims=1);
 59.742860 seconds (72.02 M allocations: 4.530 GiB, 2.89% gc time)

(except on master it's even worse)

What happened here was that a type got inferred as CartesianIndices{A,B} where {A,B} --- there are no limits on A and B even though the type has some declared bounds. That in turn caused us to infer into methods that actually could not be applicable, because we thought iterate(::CartesianIndices) might not cover every case. That led to a lot of recursion that made it very hard to infer a lot of code.

It's a bit lucky that this ends up being enough to fix it. Does not help #33336.

@JeffBezanson
Copy link
Member Author

Done with @vtjnash

@Keno Keno merged commit 7466d11 into master Oct 5, 2019
@Keno Keno deleted the jb/instanceof branch October 5, 2019 02:53
KristofferC pushed a commit that referenced this pull request Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference compiler:latency Compiler latency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants