Skip to content

Commit 945ef21

Browse files
committed
Use collection.length = lastIndex instead of pop() in swap-and-pop
Skips the unused return-value read from pop(). Semantically identical (both truncate the array by one; the packed-array fast path is preserved in either form). Also byte-identical to the same change in NVP's upstream #21221, simplifying side-by-side review.
1 parent a8e2cec commit 945ef21

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/@glimmer/destroyable/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function remove<T extends object>(collection: OneOrMany<T>, item: T, message: st
7171
if (index !== lastIndex) {
7272
collection[index] = collection[lastIndex] as T;
7373
}
74-
collection.pop();
74+
collection.length = lastIndex;
7575
return collection;
7676
} else {
7777
return null;

0 commit comments

Comments
 (0)