Skip to content

Base: bootstrap: eliminate Array-specific length methods #57627

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nsajko
Copy link
Contributor

@nsajko nsajko commented Mar 3, 2025

Three methods of length are deleted.

Made possible by moving the following methods to earlier within the bootstrapping:

  • size(a::Array)
  • length(t::AbstractArray)

Improves abstract return type inference of f(x::Array) = length(a), presumably because the method count is now low enough for the world-splitting optimization to kick in.

Three methods of `length` are deleted.

Made possible by moving the following methods to earlier within the
bootstrapping:
* `size(a::Array)`
* `length(t::AbstractArray)`

Improves abstract return type inference of `f(x::Array) = length(a)`,
presumably because the method count is now low enough for the
world-splitting optimization to kick in.
@nsajko nsajko added the arrays [a, r, r, a, y, s] label Mar 3, 2025
@nsajko nsajko marked this pull request as draft March 6, 2025 17:54
@KristofferC
Copy link
Member

length is a common function to extend so won't this increase invalidations since when someone adds a length method this will cause all the methods in base that inferred based on the method count to be invalidated?

@nsajko
Copy link
Contributor Author

nsajko commented Mar 31, 2025

Absolutely, this causes tons of invalidations, which is why I marked the PR as draft. Perhaps it'd make sense to set max_methods to 1? I keep postponing this to until the current invalidations are fixed so I haven't really given this proper thought.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants