Created
January 23, 2019 14:35
-
-
Save azz0r/5b40059edbb0e5162723d2e99acaae86 to your computer and use it in GitHub Desktop.
benchmark.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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