`slice` allocates a new array even when `v.used == v.index.length`. Could you check `v.used == v.index.length` first?