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

typeintersect: allocation tuning for large UnionAll #54745

Merged
merged 2 commits into from
Oct 4, 2024

Conversation

N5N3
Copy link
Member

@N5N3 N5N3 commented Jun 9, 2024

This PR tries to reduce the allocation caused by save_env by skipping/fusing alloc_env and truncating env when possible.
Some benchmark:

julia> @time using Makie 
3.271219 seconds (3.98 M allocations: 347.844 MiB, 12.15% gc time, 7.94% compilation time: 93% of which was recompilation) # on master
3.089503 seconds (3.66 M allocations: 237.957 MiB, 7.54% gc time, 8.49% compilation time: 93% of which was recompilation)  #PR

Other packages should see much less, or no, improvement, as it's uncommon that save_env contributes most of the allocations.

@N5N3 N5N3 added performance Must go faster types and dispatch Types, subtyping and method dispatch labels Jun 9, 2024
@N5N3 N5N3 requested a review from vtjnash June 9, 2024 17:43
`merge_env` and `final_merge_env` could be skipped
for emptiness test or if we know there's only 1 valid Union state.
This only covers the simplest cases. We might want a full dependence analysis and keep env length minimum in the future.
@N5N3 N5N3 merged commit 99cc59c into JuliaLang:master Oct 4, 2024
4 of 7 checks passed
@N5N3 N5N3 deleted the allocation_tuning branch October 4, 2024 21:34
KristofferC pushed a commit that referenced this pull request Oct 24, 2024
This PR tries to reduce the allocation caused by `save_env` by
skipping `alloc_env` and truncating env size when possible.

(cherry picked from commit 99cc59c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants