UNPKG

iso-bench

Version:

Small benchmark library focused in avoiding optimization/deoptimization pollution between tests by isolating them.

28 lines (27 loc) 906 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StreamLog = void 0; const DynamicStream_1 = require("./DynamicStream"); const StaticStream_1 = require("./StaticStream"); class StreamLog { _log; constructor(stream) { this._log = ("isTTY" in stream && stream.isTTY) ? new DynamicStream_1.DynamicStream(stream) : new StaticStream_1.StaticStream(stream); } initialize(bench, tests) { return this._log.initialize && this._log.initialize(bench, tests); } start(test) { return this._log.start && this._log.start(test); } sample(test, sample) { return this._log.sample && this._log.sample(test, sample); } end(test) { return this._log.end && this._log.end(test); } completed(tests) { return this._log.completed && this._log.completed(tests); } } exports.StreamLog = StreamLog;