Perf: minor optimization here and there

This commit is contained in:
SukkaW
2024-01-11 11:56:15 +08:00
parent d06fa6975d
commit e8f3519479
11 changed files with 80 additions and 60 deletions

View File

@@ -0,0 +1,8 @@
/**
* In-place adding of elements from an array to a set.
*/
export function setAddFromArray<T>(set: Set<T>, arr: T[]): void {
for (let i = 0, len = arr.length; i < len; i++) {
set.add(arr[i]);
}
}