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

Base: append!, resize!: convert length to Int before passing it on #57585

Merged

Conversation

nsajko
Copy link
Contributor

@nsajko nsajko commented Feb 28, 2025

Reduces the number of invalidations from 512 to 505 on running this code:

struct I <: Integer end
Base.Int(::I) = 7

@nsajko nsajko added arrays [a, r, r, a, y, s] invalidations labels Feb 28, 2025
@nsajko nsajko changed the title Base: append! convert length to Int before passing it on Base: append!: convert length to Int before passing it on Mar 1, 2025
@nsajko nsajko changed the title Base: append!: convert length to Int before passing it on Base: append!, resize!: convert length to Int before passing it on Mar 1, 2025
@nsajko nsajko force-pushed the Base_arrays_append_vector_typeassert branch from 2538b85 to b2fbf50 Compare March 2, 2025 04:25
nsajko added 3 commits March 8, 2025 19:33
Reduces the number of invalidations from 2061 to 2045 on running this
code:

```julia
struct I <: Integer end
Base.Int(::I) = 7
```

NB: `_growend!`, which the length gets passed on to, converts to `Int`
immediately anyway.
@nsajko nsajko force-pushed the Base_arrays_append_vector_typeassert branch from b10bfd4 to fc2d1c6 Compare March 8, 2025 18:33
@nsajko
Copy link
Contributor Author

nsajko commented Mar 8, 2025

Reproducer for the invalidation count:

./julia -E 'using SnoopCompileCore; i=(@snoop_invalidations (struct I <: Integer end; Base.Int(::I) = 7)); using SnoopCompile; length(uinvalidated(i))'

@nsajko nsajko added merge me PR is reviewed. Merge when all tests are passing backport 1.11 Change should be backported to release-1.11 backport 1.12 Change should be backported to release-1.12 labels Mar 9, 2025
@KristofferC KristofferC mentioned this pull request Mar 11, 2025
70 tasks
@fingolfin fingolfin merged commit a97137e into JuliaLang:master Mar 11, 2025
7 checks passed
@nsajko nsajko deleted the Base_arrays_append_vector_typeassert branch March 11, 2025 11:24
@nsajko nsajko removed the merge me PR is reviewed. Merge when all tests are passing label Mar 11, 2025
KristofferC pushed a commit that referenced this pull request Mar 20, 2025
…it on (#57585)

Reduces the number of invalidations from 512 to 505 on running this
code:

```julia
struct I <: Integer end
Base.Int(::I) = 7
```

(cherry picked from commit a97137e)
@KristofferC KristofferC removed the backport 1.12 Change should be backported to release-1.12 label Mar 24, 2025
KristofferC pushed a commit that referenced this pull request Mar 31, 2025
…it on (#57585)

Reduces the number of invalidations from 512 to 505 on running this
code:

```julia
struct I <: Integer end
Base.Int(::I) = 7
```

(cherry picked from commit a97137e)
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] backport 1.11 Change should be backported to release-1.11 invalidations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants