menu
manual-copy
Replace element-by-element copy loops with a bulk copy operation
Copying corresponding elements one at a time repeats bounds checks and hides a contiguous copy. Instead, you SHOULD use the collection's bulk copy operation.
Reported
1function copy(target: &exclusive int32[], source: &readonly int32[]): void {2 for (let index: isize = 0; index < source.length; index++) {3 target[index] = source[index];4 }5}Accepted
1function copy(target: &exclusive int32[], source: &readonly int32[]): void {2 target.view(0, source.length).copyFrom(source.view(0));3}