Most performant way to get 0-d array pointing to a variable

#1

First this my be a little ill formatted as I am typing it on my phone at a muffler shop.

I am Trying to figure out what the most performance way of generating a 0-dim array of a variable to use as passing by ref.

Now for an array location it is relatively easy to use view to do just that. Which works great but ultimately must have some over head on access.

Then there is unsafe_wrap which in theory should have less access overhead than a sub array, but my benchmark says takes 3x as long to create. Plus my same benchmark says accessing it with say a += is not much fast than the view.

Using a view I guess would be okay untill you want to use it to pass the field of a mutable type.
So is unsafe wrap the only way to do that?

#2

Ref

2 Likes
#3

Thank you I don’t know how I missed that.