Allow mutation of non-isbits eltypes#1150
Open
MasonProtter wants to merge 3 commits intoJuliaArrays:masterfrom
Open
Allow mutation of non-isbits eltypes#1150MasonProtter wants to merge 3 commits intoJuliaArrays:masterfrom
MasonProtter wants to merge 3 commits intoJuliaArrays:masterfrom
Conversation
Author
|
That's so bizarre, this test works totally fine for me locally, and the operations it's doing should be legal. |
serenity4
added a commit
to serenity4/StaticArrays.jl
that referenced
this pull request
Nov 18, 2023
serenity4
added a commit
to serenity4/StaticArrays.jl
that referenced
this pull request
Nov 18, 2023
|
This works for me too, perhaps we can give it another try? What were the issues? (logs are no longer available) I made an attempt as well, with some special-casing for certain mutable types (for which I believe the concerns of #27 do not apply): master...serenity4:setindex-nonisbits. That seems to greatly improve performance for large arrays: julia> mutable struct Mut; x::Float64; end
julia> @btime setindex!(v, $("ho"), 2) setup = v = @MArray ["ha" for i in 1:100];
408.465 ns (3 allocations: 1.62 KiB)
julia> @btime setindex!(v, $(Mut(3.0)), 2) setup = v = @MArray [Mut(rand()) for i in 1:100];
7.032 ns (0 allocations: 0 bytes)Though this optimization could be implemented later and if we are really 100% sure it won't cause any issues. I'd just try to go forward with the current PR first. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For large
MArrays, this'll be slower than if we had a properMutableTuple, but it does work and should be pretty quick for reasonable sizes. It shouldn't screw up the garbage collector or do anything unsafe like the previous version did.