diff --git a/benchmark/benchmark-helper.coffee b/benchmark/benchmark-helper.coffee index 5a4e8de99..c6086e7f3 100644 --- a/benchmark/benchmark-helper.coffee +++ b/benchmark/benchmark-helper.coffee @@ -15,14 +15,19 @@ 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.pfbenchmark = window.fpbenchmark +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 diff --git a/benchmark/benchmark-suite.coffee b/benchmark/benchmark-suite.coffee index ea12deb2f..02fcd9b1b 100644 --- a/benchmark/benchmark-suite.coffee +++ b/benchmark/benchmark-suite.coffee @@ -17,7 +17,7 @@ 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')) @@ -25,3 +25,7 @@ describe "Editor", -> editor.insertText('x') editor.backspace() + benchmark "inserting and deleting a character that causes massive token changed", -> + editor.insertText('"') + editor.backspace() + diff --git a/src/atom/editor.coffee b/src/atom/editor.coffee index aff768fc1..fa545577b 100644 --- a/src/atom/editor.coffee +++ b/src/atom/editor.coffee @@ -214,7 +214,7 @@ class Editor extends View @getLineElement(row).remove() getLineElement: (row) -> - @lines.find("div.line:eq(#{row})") + $(@lines[0].querySelector("div.line")[row]) toggleSoftWrap: -> @setSoftWrap(not @softWrap)