import { prettyBenchmarkHistory } from "https://deno.land/x/pretty_benching@v0.3.3/pretty_benchmark_history.ts";
Handles and enforces the set rules on the historic benchmarking data.
Typical usage:
// add benches, then
let historicData;
try {
historicData = JSON.parse(Deno.readTextFileSync("./benchmarks/history.json"));
} catch {
// Decide whether you want to proceed with no history
console.warn("⚠ cant read history file");
}
const history = new prettyBenchmarkHistory(historicData, {
//options
});
runBenchmarks().then((results: BenchmarkRunResult) => {
history.addResults(results);
Deno.writeTextFileSync("./benchmarks/history.json", history.getDataString());
});
Note
The saving and loading of the generated data is the user's responsibility, this class is not doing any file handling. See examples for more info.
Constructors
Properties
Methods
Stores the run's result into the historic data, enforces all set rules on the results.
Calculates deltas
for given BenchmarkResult
for each provided property key.
Keys are either measuredRunsAvgMs
, totalMs
or point to number
properties of the calculated extras
.
Error is thrown, when a key points to a non number property.
No delta is calculated for key's which are not present in the extras
Returns false
when there is no history for the given benchmark.
Calculates deltas
for each benchmark in the provided BenchmarkRunResult
for each provided property key.
Keys are either measuredRunsAvgMs
, totalMs
or point to number
properties of the calculated extras
.
Error is thrown, when a key points to a non number property.
No delta is calculated for key's which are not present in the extras
Returns false
for a given benchmark when there is no history for it.