pulsar/benchmark/benchmark-suite.coffee

109 lines
2.8 KiB
CoffeeScript
Raw Normal View History

require 'benchmark-helper'
fs = require 'fs'
$ = require 'jquery'
2012-09-25 02:47:33 +04:00
_ = require 'underscore'
TokenizedBuffer = require 'tokenized-buffer'
describe "editor.", ->
editor = null
beforeEach ->
window.rootViewParentSelector = '#jasmine-content'
2012-10-31 22:50:28 +04:00
window.attachRootView(require.resolve('benchmark/fixtures'))
rootView.width(1024)
rootView.height(768)
rootView.open() # open blank editor
editor = rootView.getActiveEditor()
afterEach ->
$(window).off 'beforeunload'
window.shutdown()
atom.setRootViewStateForPath(rootView.project.getPath(), null)
describe "keymap.", ->
event = null
beforeEach ->
event = keydownEvent('x', target: editor.hiddenInput[0])
benchmark "keydown-event-with-no-binding", 10, ->
keymap.handleKeyEvent(event)
describe "opening-buffers.", ->
benchmark "300-line-file.", ->
buffer = rootView.project.bufferForPath('medium.coffee')
describe "empty-file.", ->
benchmark "insert-delete", ->
editor.insertText('x')
editor.backspace()
describe "300-line-file.", ->
beforeEach ->
2012-10-31 22:50:28 +04:00
rootView.open('medium.coffee')
describe "at-begining.", ->
benchmark "insert-delete", ->
editor.insertText('x')
editor.backspace()
benchmark "insert-delete-rehighlight", ->
editor.insertText('"')
editor.backspace()
describe "at-end.", ->
beforeEach ->
editor.moveCursorToBottom()
benchmark "insert-delete", ->
editor.insertText('"')
editor.backspace()
describe "9000-line-file.", ->
benchmark "opening.", 5, ->
2012-10-31 22:50:28 +04:00
rootView.open('huge.js')
describe "after-opening.", ->
beforeEach ->
2012-10-31 22:50:28 +04:00
rootView.open('huge.js')
benchmark "moving-to-eof.", 1, ->
editor.moveCursorToBottom()
describe "on-first-line.", ->
benchmark "inserting-newline", 5, ->
editor.insertNewline()
describe "on-last-visible-line.", ->
beforeEach ->
editor.setCursorScreenPosition([editor.getLastVisibleScreenRow(), 0])
benchmark "move-down-and-scroll", 300, ->
editor.trigger 'move-down'
describe "at-eof.", ->
endPosition = null
beforeEach ->
editor.moveCursorToBottom()
endPosition = editor.getCursorScreenPosition()
benchmark "move-to-beginning-of-word", ->
editor.moveCursorToBeginningOfWord()
editor.setCursorScreenPosition(endPosition)
benchmark "insert", ->
editor.insertText('x')
describe "TokenizedBuffer.", ->
describe "coffee-script-grammar.", ->
[languageMode, buffer] = []
beforeEach ->
editSession = benchmarkFixturesProject.buildEditSessionForPath('medium.coffee')
{ languageMode, buffer } = editSession
2012-09-25 02:47:33 +04:00
benchmark "construction", 20, ->
2012-10-11 21:25:04 +04:00
new TokenizedBuffer(buffer, { languageMode, tabLength: 2})