"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: all[name]
    });
}
_export(exports, {
    bench: function() {
        return bench;
    },
    noop: function() {
        return noop;
    }
});
const _logger = require("../handlers/logger");
const logger = new _logger.LoggerService("BenchmarkUtil");
async function bench(cb, report = false) {
    const beforeTime = Date.now();
    let result;
    try {
        result = await cb();
    } catch (e) {
        logger.error(e);
    }
    const afterTime = Date.now();
    if (!!report) {
        return {
            result,
            time: afterTime - beforeTime
        };
    } else return result;
}
function noop() {}

//# sourceMappingURL=benchmark.util.js.map