fix(benchmarks): don’t force gc on the `profile` buttons (#14345)
This causes v8 to depotimize functions permanently in same cases.
This commit is contained in:
parent
7a4c25535d
commit
f6b5965a63
|
@ -41,22 +41,9 @@ export function bindAction(selector: string, callback: () => void) {
|
||||||
|
|
||||||
export function profile(create: () => void, destroy: () => void, name: string) {
|
export function profile(create: () => void, destroy: () => void, name: string) {
|
||||||
return function() {
|
return function() {
|
||||||
window.console.profile(name + ' w GC');
|
window.console.profile(name);
|
||||||
let duration = 0;
|
let duration = 0;
|
||||||
let count = 0;
|
let count = 0;
|
||||||
while (count++ < 150) {
|
|
||||||
(<any>window)['gc']();
|
|
||||||
const start = window.performance.now();
|
|
||||||
create();
|
|
||||||
duration += window.performance.now() - start;
|
|
||||||
destroy();
|
|
||||||
}
|
|
||||||
window.console.profileEnd();
|
|
||||||
window.console.log(`Iterations: ${count}; time: ${duration / count} ms / iteration`);
|
|
||||||
|
|
||||||
window.console.profile(name + ' w/o GC');
|
|
||||||
duration = 0;
|
|
||||||
count = 0;
|
|
||||||
while (count++ < 150) {
|
while (count++ < 150) {
|
||||||
const start = window.performance.now();
|
const start = window.performance.now();
|
||||||
create();
|
create();
|
||||||
|
|
Loading…
Reference in New Issue