Add .gitignore to exclude all node packages and lock files
This commit is contained in:
+37
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getPerf = exports.stopPerfMeasure = exports.startPerfMeasure = void 0;
|
||||
const perf = {
|
||||
capture: [],
|
||||
'extract-frame': [],
|
||||
piping: [],
|
||||
};
|
||||
const map = {};
|
||||
const startPerfMeasure = (marker) => {
|
||||
const id = Math.random();
|
||||
map[id] = {
|
||||
id,
|
||||
marker,
|
||||
start: Date.now(),
|
||||
};
|
||||
return id;
|
||||
};
|
||||
exports.startPerfMeasure = startPerfMeasure;
|
||||
const stopPerfMeasure = (id) => {
|
||||
const now = Date.now();
|
||||
const diff = now - map[id].start;
|
||||
perf[map[id].marker].push(diff);
|
||||
delete map[id];
|
||||
};
|
||||
exports.stopPerfMeasure = stopPerfMeasure;
|
||||
const getPerf = () => {
|
||||
return [
|
||||
'Render performance:',
|
||||
...Object.keys(perf)
|
||||
.filter((p) => perf[p].length)
|
||||
.map((p) => {
|
||||
return ` ${p} => ${Math.round(perf[p].reduce((a, b) => a + b, 0) / perf[p].length)}ms (n = ${perf[p].length})`;
|
||||
}),
|
||||
];
|
||||
};
|
||||
exports.getPerf = getPerf;
|
||||
Reference in New Issue
Block a user