const bcell = new Float64Array(barrage.__wasm.memory.buffer, this.bulletsPtr, this.bulletsLen);
The only problem is it's too slow for 60 fps. I did some profiling and the act of creating that Float64Array takes 15ms in my case. If I comment the above line, I go back up to 60 fps even though I'm still reading from the entire array.
To speed things up, I thought I would be able to cache the creation of this array in the constructor of my object, but it doesn't work. It seems to only work if I create the array anew for each tick.
I can even do something hacky like initialize the array only once or even 10 times in the tick function, but then all the bullets freeze in time after I stop creating a new array object because it holds the same values.
My understanding was the Float64Array should just be a view over a block of memory, so I thought I should only have to create it once, but that doesn't seem to be the case.
Is there a way to just cache the creation of this Float64Array? I think I'm dealing with the same view over the same block of memory every tick. The size of my array doesn't change.