Remove PrepPerf as it blocls garbage collection

This commit is contained in:
Pieter Vander Vennet 2022-06-05 13:56:12 +02:00 committed by GitHub
parent 4283b76f36
commit 1bc7d9118a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -250,32 +250,12 @@ export class ImmutableStore<T> extends Store<T> {
export class UIEventSource<T> extends Store<T> {
private static allSources: UIEventSource<any>[] = UIEventSource.PrepPerf();
public data: T;
private _callbacks: ((t: T) => (boolean | void | any)) [] = [];
constructor(data: T, tag: string = "") {
super(tag);
this.data = data;
UIEventSource.allSources.push(this);
}
static PrepPerf(): UIEventSource<any>[] {
if (Utils.runningFromConsole) {
return [];
}
// @ts-ignore
window.mapcomplete_performance = () => {
console.log(UIEventSource.allSources.length, "uieventsources created");
const copy = [...UIEventSource.allSources];
copy.sort((a, b) => b._callbacks.length - a._callbacks.length);
console.log("Topten is:")
for (let i = 0; i < 10; i++) {
console.log(copy[i].tag, copy[i]);
}
return UIEventSource.allSources;
}
return [];
}
public static flatten<X>(source: Store<Store<X>>, possibleSources?: Store<any>[]): UIEventSource<X> {
@ -507,4 +487,4 @@ export class UIEventSource<T> extends Store<T> {
})
}
}
}