Very simple code, why would there be performance problems

Welcome! To echo Oscar’s complaint, you already have a mutable struct, so you don’t need the Ref here.

If you really want the behavior of a C pointer, replace Ref with Base.RefValue{Float64} to avoid using an abstract type.

2 Likes