I want to push a `1` to every fourth element of a Float32Array. My current solution is to convert said Float32Array into an array, iterating through it and applying `.splice` on every fourth element like so (I also convert the array to a buffer afterward but that is not relevant for this question):

```
function pushToEveryFourthAndConvertToBuffer(floatArray: Float32Array): Buffer {
  const array: number[] = [...floatArray];
  for (let i: number = 3; i <= array.length; i += 4) array.splice(i, 0, 1);
  return Buffer.from(array);
}

```

while this works, it is not performant at all. My Float32Array has 660000 entries (thus, the returned buffer has 880000) and this function gets called with about 100 different Float32Arrays. If I remove the for-loop from the function, it runs much faster so I can be very sure my method of applying the elements is causing the bottle neck.

Is there a more efficient way or does my CPU just have to suffer and do I have to wait really long since I don't want to implement a multi-threaded solution?

Edit:
I'll provide some input and expected output here to clarify my question:

```
new Float32Array([0, 0, 0,    0, 0, 0,    0, 0, 0]); // ← input
new Float32Array([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1]); // ← output

new Float32Array([1, 2, 3,    4, 5, 6,    7, 8, 9]) // ← input
new Float32Array([1, 2, 3, 1, 4, 5, 6, 1, 7, 8, 9]) // ← output

new Float32Array([0.2321, 0.294, 0.1246,    0.9352, 0.87423, 0.11]); // ← input
new Float32Array([0.2321, 0.294, 0.1246, 1, 0.9352, 0.87423, 0.11, 1]); // ← output

```