Skip to content

Conversation

Keno
Copy link
Member

@Keno Keno commented Jan 17, 2023

By bumping max_methods for eltype slightly to cover all four Tuple methods.

By bumping max_methods for `eltype` slightly to cover all four
Tuple methods.
@aviatesk
Copy link
Member

Would this be generally useful? I mean, if this improvement is useful especially for some external AbstractInterpreter, then it might be more reasonable if we have a special case in their code base and not in Base.

@Keno
Copy link
Member Author

Keno commented Jan 18, 2023

Yes, it allowed inference to know that eltype(::Tuple) is foldable, which improves effects generally and can speed up inference for code that uses this method (which is a lot since it's used in the kwargs machinery).

@aviatesk aviatesk merged commit 15b7c6b into master Jan 18, 2023
@aviatesk aviatesk deleted the kf/eltypeeff branch January 18, 2023 08:01
nsajko added a commit to nsajko/julia that referenced this pull request Jun 21, 2025
The `eltype` function was one of the few functions in the sysimage with
a `max_methods` value (the world-splitting threshold) greater than the
default. This was a workaround for the unnecessarily large number of
methods of `eltype(::Type{<:Tuple})`. The `max_methods` value was
increased in PR JuliaLang#48322 to help effect inference.

Reduce the number of `eltype(::Type{<:Tuple})` methods, which then also
allows keeping the `max_methods` for `eltype` at the default value.

The intent here is to guard against unnecessary invalidation of the
sysimage or other precompiled code, which might require decreasing the
`max_methods` value to the natural minimum for many interface functions,
by which I mean "generic function meant to have methods added to it by
package authors". See also: PR JuliaLang#57884.
nsajko added a commit to nsajko/julia that referenced this pull request Jun 21, 2025
The `eltype` function was one of the few functions in the sysimage with
a `max_methods` value (the world-splitting threshold) greater than the
default. This was a workaround for the unnecessarily large number of
methods of `eltype(::Type{<:Tuple})`. The `max_methods` value was
increased in PR JuliaLang#48322 to help effect inference.

Reduce the number of `eltype(::Type{<:Tuple})` methods, which then also
allows keeping the `max_methods` for `eltype` at the default value.

The intent here is to guard against unnecessary invalidation of the
sysimage or other precompiled code, which might require decreasing the
`max_methods` value to the natural minimum for many interface
functions, by which I mean "generic function meant to have methods
added to it by package authors". I intend to approach this issue in
following PRs. See also: PR JuliaLang#57884.

Regarding future work: I consider the "natural minimum" value for
interface functions taking types to be **two**, because the bottom type
subtypes each type. If the interface function doesn't accept types, the
natural minimum should be **one**.
nsajko added a commit to nsajko/julia that referenced this pull request Jun 21, 2025
The `eltype` function was one of the few functions in the sysimage with
a `max_methods` value (the world-splitting threshold) greater than the
default. This was a workaround for the unnecessarily large number of
methods of `eltype(::Type{<:Tuple})`. The `max_methods` value was
increased in PR JuliaLang#48322 to help effect inference.

Reduce the number of `eltype(::Type{<:Tuple})` methods, which then also
allows keeping the `max_methods` for `eltype` at the default value.

The intent here is to guard against unnecessary invalidation of the
sysimage or other precompiled code, which might require decreasing the
`max_methods` value to the natural minimum for many interface
functions, by which I mean "generic function meant to have methods
added to it by package authors". I intend to approach this issue in
following PRs. See also: PR JuliaLang#57884.

Regarding future work: I consider the "natural minimum" value for
interface functions taking types to be **two**, because the bottom type
subtypes each type. If the interface function doesn't accept types, the
natural minimum should be **one**.
JeffBezanson pushed a commit that referenced this pull request Aug 28, 2025
#58788)

The `eltype` function was one of the few functions in the sysimage with
a `max_methods` value (the world-splitting threshold) greater than the
default. This was a workaround for the unnecessarily large number of
methods of `eltype(::Type{<:Tuple})`. The `max_methods` value was
increased in PR #48322 to help effect inference.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants