Skip to content

Instantly share code, notes, and snippets.

@azz0r
Created January 23, 2019 14:35
Show Gist options
  • Select an option

  • Save azz0r/5b40059edbb0e5162723d2e99acaae86 to your computer and use it in GitHub Desktop.

Select an option

Save azz0r/5b40059edbb0e5162723d2e99acaae86 to your computer and use it in GitHub Desktop.
benchmark.js
import Benchmark from "benchmark";
import modifiers from "./modifiers";
import data from "./fixtures";
import factory from "../src";
const suite = new Benchmark.Suite();
suite
.add("Factory", function () {
try {
factory({
data,
modifiers
});
} catch (error) {
console.log(error, "error");
}
})
// .add(" - Second Factory - ", function() {
// try {
// second({ data, modifiers });
// } catch (error) {
// console.log(error, "error");
// }
// })
.on("cycle", function (event) {
console.log(String(event.target));
})
.on("complete", function () {
console.log("Fastest is " + this.filter("fastest").map("name"));
})
.run({
async: true
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment