Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MutatePlainDataArray"
uuid = "3b0f367b-da20-4531-811a-c13cc92422b5"
authors = ["Haoran Ni <[email protected]> and contributors"]
version = "1.0.0-dev"
version = "1.0.0"

[compat]
julia = "1.6"
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@ julia> b
The mutation provided by this package is
- **Efficient**. Under the hood, the mutation is achieved by pointer load/store, where the address offset is known at type inference time.
- **Safe**. Compile-time type check is enforced. Reference to the original vector is obtained to prevent garbage collection. Bounds check is performed unless `@inbounds` is used. This package is inspired by and acts as a safer counterpart to [UnsafePointers.jl](https://github.com/cjdoris/UnsafePointers.jl).

## See also

[StructArrays.jl](https://github.com/JuliaArrays/StructArrays.jl)
[FieldViews.jl](https://github.com/MasonProtter/FieldViews.jl)
[BangBang.jl](https://github.com/JuliaFolds/BangBang.jl)
1 change: 1 addition & 0 deletions benchmark/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ BangBang = "198e06fe-97b7-11e9-32a5-e1d131e6ad66"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
MutatePlainDataArray = "3b0f367b-da20-4531-811a-c13cc92422b5"
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[sources]
MutatePlainDataArray = {path = ".."}
7 changes: 5 additions & 2 deletions benchmark/runbenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ using MutatePlainDataArray
using BenchmarkTools
using Setfield
using BangBang
using StaticArrays

M = @SMatrix(ones(10,10))

struct BAB
a::Int
Expand All @@ -17,9 +20,9 @@ struct BAI1
c::Int
d::Int
bab::BAB
m::Float64
m::typeof(M)
end
BAI1() = BAI1(0, 0, 0, 0, BAB(), 100)
BAI1() = BAI1(0, 0, 0, 0, BAB(), M)


function inbounds_setinner!_mutate(v, i)
Expand Down
Loading