Any problem with using default Array to hold Float32Array values?

So I’m editing a selected geometry.attributes.position.array values temporarily for an effect
and to revert back to original state i’m using a array to backup all the position array values .(just adding by index from float32array to this array & vice versa when resotring)
and it seems to work correctly

since the values were stored in a float32Array, am i losing any precision by using a normal array instead of an typed array or are there any other shortcomings ?

or is there any alternate methods ?

Default arrays have higher precision than float32, so you’re not losing anything. It sounds OK. If the array is large, and its size is known in advance, you may find that allocating a typed array ahead of time will perform a little faster.

1 Like

@donmccurdy Thanks! , was worried about precision

I apply and restore the effect on one geometry at a time
so with typed array i do know the array size in advance but I’ll have to create a new float32array for each unique geometry

with normal array i can empty the same array using splice and re-use the array every time the effect is used

any flaw in this logic ?

It’s not obvious to me which way will have better performance there. You can always test it, but if it’s performing well enough for your goals I wouldn’t worry about it.

1 Like

It’s just being wasteful converting TypeArray to Array.
Try: Float32Array.prototype.slice()
If you wanna continue this conversation, open a new thread.

2 Likes