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

Add nospecialize to methodswith #47302

Merged
merged 1 commit into from
Oct 24, 2022
Merged

Conversation

jakobnissen
Copy link
Member

@jakobnissen jakobnissen commented Oct 24, 2022

On current master, calling methodswith compiles a new specialization for each type being checked, which easily runs into the hundreds of specializations, completely unnecessarily.
This PR adds a bunch of nospecialize statements to methodswith to reduce latency significantly - by about a factor of 7 on my laptop.

Improves #43468 quite significantly - though might not completely solve it. On my computer, methodswith(String) takes about 450 ms on Julia 1.0, and 485 ms with this PR, compared to 3.5-5.5 seconds on Julia 1.8.2.

On current master, calling methodswith compiles a new specialization for each
type being checked, which easily runs into the hundreds of specializations,
completely unnecessarily.
This PR adds a bunch of nospecialize statements to methodswith to reduce
latency significantly.
@jakobnissen
Copy link
Member Author

Test failures seem to be due to some kind of network error. I don't think they're related.

@LilithHafner
Copy link
Member

Looks quite sensible, and the time to second methodswith doesn't increase according to @btime.

Thank you for your contribution!

@LilithHafner LilithHafner merged commit 6be72c6 into JuliaLang:master Oct 24, 2022
@LilithHafner LilithHafner added the latency Latency label Oct 24, 2022
@jakobnissen jakobnissen deleted the methodswith branch October 24, 2022 12:03
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.

2 participants