add fpbenchmark and fbenchmark

This commit is contained in:
Corey Johnson & Nathan Sobo 2012-03-08 18:11:40 -08:00
parent ffeab94472
commit 51c02f236c
2 changed files with 11 additions and 7 deletions

View File

@ -15,14 +15,18 @@ keymap.bindKeys '*',
$(document).on 'close', -> window.close()
$(document).on 'show-console', -> window.showConsole()
window.profile = (description, fn) ->
window.showConsole()
window.benchmark(description, fn, true)
window.pbenchmark = window.profile
window.fpbenchmark = (description, fn) -> window.profile(description, fn, true)
window.fbenchmark = (description, fn, profile) -> window.benchmark(description, fn, profile, true)
window.benchmark = (description, fn, profile=false) ->
it description, ->
window.profile = (description, fn, focused) ->
window.showConsole()
window.benchmark(description, fn, true, focused)
window.benchmark = (description, fn, profile=false, focused=false) ->
method = if focused then fit else it
method description, ->
count = 100
total = measure ->
console.profile(description) if profile

View File

@ -17,11 +17,11 @@ describe "Editor", ->
editor.insertText('x')
editor.backspace()
fdescribe "when editing a ~300 line CoffeeScript file", ->
describe "when editing a ~300 line CoffeeScript file", ->
beforeEach ->
editor.setBuffer new Buffer(require.resolve('fixtures/medium.coffee'))
benchmark "inserting and deleting a character", ->
fbenchmark "inserting and deleting a character", ->
editor.insertText('x')
editor.backspace()