Skip to content

Conversation

@vtjnash
Copy link
Member

@vtjnash vtjnash commented Sep 30, 2025

This uses inferred element types to make the iterator state type-stable, enabling inlining, which can enable the runtime to see the real types.

Fix #56607

julia> @btime f()
  574.500 ns (2 allocations: 272 bytes) # non-const op
  253.878 ns (2 allocations: 272 bytes) # const op

This uses inferred element types to make the iterator state type-stable,
enabling inlining, which can enable the runtime to see the real types.

Fix #56607

julia> @Btime f()
  574.500 ns (2 allocations: 272 bytes) # non-const op
  253.878 ns (2 allocations: 272 bytes) # const op
@vtjnash vtjnash added performance Must go faster iteration Involves iteration or the iteration protocol backport 1.12 Change should be backported to release-1.12 labels Sep 30, 2025
@vtjnash vtjnash merged commit 498d982 into master Oct 2, 2025
10 of 12 checks passed
@vtjnash vtjnash deleted the jn/56607 branch October 2, 2025 17:57
@KristofferC KristofferC mentioned this pull request Oct 6, 2025
47 tasks
KristofferC pushed a commit that referenced this pull request Oct 10, 2025
This uses inferred element types to make the iterator state type-stable,
enabling inlining, which can enable the runtime to see the real types.
This is essentially the transform that we want inference to infer and
codegen to implement, except made explicit so that we can rely on it
actually happening.

Fix #56607

```
julia> @Btime f()
  574.500 ns (2 allocations: 272 bytes) # non-const op
  253.878 ns (2 allocations: 272 bytes) # const op
```

(cherry picked from commit 498d982)
KristofferC pushed a commit that referenced this pull request Oct 12, 2025
This uses inferred element types to make the iterator state type-stable,
enabling inlining, which can enable the runtime to see the real types.
This is essentially the transform that we want inference to infer and
codegen to implement, except made explicit so that we can rely on it
actually happening.

Fix #56607

```
julia> @Btime f()
  574.500 ns (2 allocations: 272 bytes) # non-const op
  253.878 ns (2 allocations: 272 bytes) # const op
```

(cherry picked from commit 498d982)
KristofferC pushed a commit that referenced this pull request Oct 14, 2025
This uses inferred element types to make the iterator state type-stable,
enabling inlining, which can enable the runtime to see the real types.
This is essentially the transform that we want inference to infer and
codegen to implement, except made explicit so that we can rely on it
actually happening.

Fix #56607

```
julia> @Btime f()
  574.500 ns (2 allocations: 272 bytes) # non-const op
  253.878 ns (2 allocations: 272 bytes) # const op
```

(cherry picked from commit 498d982)
@KristofferC KristofferC removed the backport 1.12 Change should be backported to release-1.12 label Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

iteration Involves iteration or the iteration protocol performance Must go faster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Performance regression: iterating Tuples of Functions allocates

4 participants