性能优化

This commit is contained in:
YHH
2022-03-07 16:00:48 +08:00
parent 3f7ef284fc
commit e207952786
9 changed files with 366 additions and 393 deletions

View File

@@ -31,14 +31,20 @@ module es {
public union(other: PairSet<T>) {
const otherAll = other.all;
for (const elem of otherAll) {
this.add(elem);
}
if (otherAll.length > 0)
for (let i = 0; i < otherAll.length; i ++) {
const elem = otherAll[i];
this.add(elem);
}
}
public except(other: PairSet<T>) {
const otherAll = other.all;
for (const elem of otherAll) {
if (otherAll.length > 0)
for (let i = 0; i < otherAll.length; i ++) {
const elem = otherAll[i];
this.remove(elem);
}
}