diff --git a/benchmark/benchmark-helper.coffee b/benchmark/benchmark-helper.coffee index c12914921..29cfc80b1 100644 --- a/benchmark/benchmark-helper.coffee +++ b/benchmark/benchmark-helper.coffee @@ -15,23 +15,22 @@ keymap.bindKeys '*', $(document).on 'close', -> window.close() $(document).on 'show-console', -> window.showConsole() -window.fpbenchmarkOnce = (description, fn) -> window.profile(1, description, fn, true) -window.pfbenchmark = window.fpbenchmarkOnce - defaultCount = 100 -window.fpbenchmark = (description, fn) -> window.profile(defaultCount, description, fn, true) +window.pbenchmark = (args...) -> window.benchmark(args..., profile: true) +window.fbenchmark = (args...) -> window.benchmark(args..., focused: true) +window.fpbenchmark = (args...) -> window.benchmark(args..., profile: true, focused: true) window.pfbenchmark = window.fpbenchmark -window.pbenchmark = (description, fn) -> window.profile(defaultCount, description, fn, false) -window.fbenchmark = (description, fn) -> window.benchmark(description, fn, false, true) -window.profile = (count, description, fn, focused) -> - window.showConsole() - window.rawBenchmark(count, description, fn, true, focused) +window.benchmark = (args...) -> + description = args.shift() + if typeof args[0] is 'number' + count = args.shift() + else + count = defaultCount + [fn, options] = args + { profile, focused } = (options ? {}) -window.benchmarkOnce = (args...) -> window.rawBenchmark(1, args...) -window.benchmark = (args...) -> window.rawBenchmark(defaultCount, args...) - -window.rawBenchmark = (count, description, fn, profile=false, focused=false) -> + window.showConsole() if profile method = if focused then fit else it method description, -> total = measure -> diff --git a/benchmark/benchmark-suite.coffee b/benchmark/benchmark-suite.coffee index 679577fa7..deabe62ae 100644 --- a/benchmark/benchmark-suite.coffee +++ b/benchmark/benchmark-suite.coffee @@ -42,7 +42,7 @@ describe "editor.", -> editor.backspace() describe "9000-line-file.", -> - benchmarkOnce "opening", -> + benchmark "opening", 1, -> editor.setBuffer new Buffer(require.resolve('fixtures/huge.js')) describe "at-end.", ->