UNPKG

440 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.getDiff = void 0;
4const perf_hooks_1 = require("perf_hooks");
5function getDiff(cycles, callback, setup) {
6 const setupData = setup && setup();
7 const startTS = perf_hooks_1.performance.now();
8 while (cycles-- > 0) {
9 callback(setupData);
10 }
11 return perf_hooks_1.performance.now() - startTS;
12}
13exports.getDiff = getDiff;