Hi everyone!
I’d like to share GooseArrays.jl, a package inspired by Goose’s memory management approach.
The idea is to provide temporary, mutable Julia arrays with fixed sizes and explicit lifetimes, backed by a reusable memory arena rather than ordinary GC-managed array storage.
The package provides two main types:
GooseArray: fixed-size arrays without specializing on their length.StaticGooseArray: arrays with dimensions encoded in the type for additional compiler optimizations.
Here’s a small example:
using GooseArrays
result = with_datastack(1 << 20) do s
x = GooseVector{Float64}(s, undef, 4)
fill!(x, 2.0)
y = StaticGooseVector{Float64,4}(s, undef)
y .= 2 .* x .+ 1
Array(y)
end
I’ve also benchmarked the package against Array, FixedSizeArrays.jl, and StaticArrays.jl. The first results are promising, particularly for temporary arrays and avoiding GC allocations, although performance depends on the workload.
The package is still experimental (v0.1) with some parts a little too vibe coded and unpublished yet, I’d still be happy to get feedback, suggestions, or ideas for improvements!
- One thing that may change: Normal and Static seems to have very similar perf (a little better for static) and static doesn’t seem to add unreasonable specialisation meaning GooseArrays may become a version than can change size at some point which would also clear up ;the difference with AllocArrays.jl which for now is quite close to GooseArrays
GitHub: GitHub - yolhan83/GooseArrays.jl · GitHub
Documentation: Home · GooseArrays.jl
Benchmarks: Performance · GooseArrays.jl