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

Manually split string(a::Union{Char, String, SubString{String}, Symbol}...) #43939

Merged
merged 2 commits into from
Jan 26, 2022

Conversation

timholy
Copy link
Member

@timholy timholy commented Jan 25, 2022

4 is one too many for automatic Union-splitting. Poor inference in
this method accounts for more than 2000 invalidations.

Fix (at least partial) for #43157. I don't remember my numbers before this change, but if my vague memory is correct this knocks ~1s off the using Plots time and ~2s off display(plot(rand(10))). It also brings the number of invalidations down from 2622 to 599.

The regression appears to have been introduced in #41992---a very innocuous-seeming change. There still may be more TTFP to fix, though.

…ol}...)`

4 is one too many for automatic Union-splitting.  Poor inference in
this method accounts for more than 1000 invalidations.
@timholy timholy added the latency Latency label Jan 25, 2022
@Keno
Copy link
Member

Keno commented Jan 26, 2022

4 is one too many for automatic Union-splitting

@JeffBezanson is it worth increasing the limit if the argument is annotated with an explicit Union?

@aviatesk
Copy link
Member

4 is one too many for automatic Union-splitting

@JeffBezanson is it worth increasing the limit if the argument is annotated with an explicit Union?

We union-split up to 4:

union_splitting::Int = 4,

and so I think this method will be inferred accurately if the union-splitting happens.

I rather guess we somehow fail to infer for v in a and v at L220 got inferred very loosely?

@N5N3
Copy link
Member

N5N3 commented Jan 26, 2022

The inference was blocked as we set

const MAX_TYPEUNION_COMPLEXITY = 3
const MAX_TYPEUNION_LENGTH = 3

I guess it's not a good idea to increase them?

@KristofferC KristofferC merged commit 051ab3b into master Jan 26, 2022
@KristofferC KristofferC deleted the teh/manual_usplit_string branch January 26, 2022 14:48
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
…ol}...)` (JuliaLang#43939)

* Manually split `string(a::Union{Char, String, SubString{String}, Symbol}...)`

4 is one too many for automatic Union-splitting.  Poor inference in
this method accounts for more than 1000 invalidations.
timholy added a commit that referenced this pull request Mar 7, 2022
This is follow-on work to #43939
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
…ol}...)` (JuliaLang#43939)

* Manually split `string(a::Union{Char, String, SubString{String}, Symbol}...)`

4 is one too many for automatic Union-splitting.  Poor inference in
this method accounts for more than 1000 invalidations.
timholy added a commit that referenced this pull request Mar 9, 2022
This is follow-on work to #43939
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
latency Latency
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants