The type stability definitely helps, but yeah there’s extra work in retrieving the value from the heap. I don’t know if dereferencing happens every time the variable is used or if the compiler tries to reduce it, I would need to learn how to read @code_llvm
. There’s an extra layer to it where a typed global::T
need more dereferencing than a const
Ref{T}
.
1 Like