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

reimplement the recursive impls of findfirst, findlast #54480

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nsajko
Copy link
Contributor

@nsajko nsajko commented May 15, 2024

Better type inference example:

julia> Core.Compiler.return_type(Base._findlast_rec, Tuple{typeof(_ -> rand(Bool)),Tuple})
Union{Nothing, Int64}

Example of better effects:

julia> Base.infer_effects(Base._findlast_rec, Tuple{typeof(Returns(true)),Tuple{Vararg{Any,50}}})
(+c,+e,+n,+t,+s,?m,+u)

julia> Base.infer_effects(Base._findlast_rec, Tuple{typeof(Returns(false)),Tuple{Vararg{Any,50}}})
(+c,+e,+n,+t,+s,?m,+u)

FTR, this PR is part of a series of changes which (re)implement many of the operations on tuples using a new recursive technique. The ultimate goal is to hopefully increase the value of the loop-vs-recurse cutoff (Any32, sometimes hardcoded 32) for tuple operations.

Better type inference example:

```julia-repl
julia> Core.Compiler.return_type(Base._findlast_rec, Tuple{typeof(_ -> rand(Bool)),Tuple})
Union{Nothing, Int64}
```

Example of better effects:

```julia-repl
julia> Base.infer_effects(Base._findlast_rec, Tuple{typeof(Returns(true)),Tuple{Vararg{Any,50}}})
(+c,+e,+n,+t,+s,?m,+u)

julia> Base.infer_effects(Base._findlast_rec, Tuple{typeof(Returns(false)),Tuple{Vararg{Any,50}}})
(+c,+e,+n,+t,+s,?m,+u)
```

FTR, this PR is part of a series of changes which (re)implement many of
the operations on tuples using a new recursive technique. The ultimate
goal is to hopefully increase the value of the loop-vs-recurse cutoff
(`Any32`, sometimes hardcoded `32`) for tuple operations.
@nsajko nsajko added the domain:collections Data structures holding multiple items, e.g. sets label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:collections Data structures holding multiple items, e.g. sets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant