--- tags: ['verb-tag-jscomments'] --- # {%= name %} {%= badge("fury") %} > {%= description %} ## Install {%= include("install", {g: true}) %} ## Usage Create a new benchmark file in the `benchmark` folder and setup some benchmarks: ```js var grade = require('grade'); // create a new instance of Benchmark var Benchmark = grade.Benchmark; var benchmark = new Benchmark(); // create a method that will run before the method under test var beforeI = 0; function before () { beforeI++; } // create a method that will run after the method under test var afterI = 0; function after () { afterI++; } // create the actual method under test var total = 0; var test = function () { var i = 0; while ((i++) < 50000) {} total += (beforeI + afterI); }; // add the actual benchmark to the list of benchmarks to run benchmark.add('main', test, before, after); // export the benchmark object so the runner knows what to run module.exports = benchmark; ``` ## Grade {%= jscomments("index.js") %} ## Benchmark {%= jscomments("lib/benchmark.js") %} ## Timer {%= jscomments("lib/timer.js") %} ## Author {%= include("author") %} ## License {%= copyright() %} {%= license() %} *** {%= include("footer") %}