Add benchmark for tokenization.

This commit is contained in:
Nathan Sobo 2012-08-06 18:28:51 -06:00 committed by Corey Johnson & Nathan Sobo
parent e5578eebee
commit b93ee2d876
2 changed files with 19 additions and 2 deletions

View File

@ -4,9 +4,12 @@ _ = require 'underscore'
Keymap = require 'keymap'
Point = require 'point'
RootView = require 'root-view'
Project = require 'project'
require 'window'
requireStylesheet "jasmine.css"
RootView.prototype.loadUserConfiguration = ->
keymap = new Keymap
@ -24,6 +27,8 @@ window.fbenchmark = (args...) -> window.benchmark(args..., focused: true)
window.fpbenchmark = (args...) -> window.benchmark(args..., profile: true, focused: true)
window.pfbenchmark = window.fpbenchmark
window.benchmarkFixturesProject = new Project(require.resolve 'benchmark/fixtures')
window.benchmark = (args...) ->
description = args.shift()
if typeof args[0] is 'number'

View File

@ -1,7 +1,7 @@
Buffer = require 'buffer'
fs = require 'fs'
require 'benchmark-helper'
fs = require 'fs'
$ = require 'jquery'
TokenizedBuffer = require 'tokenized-buffer'
describe "editor.", ->
editor = null
@ -79,3 +79,15 @@ describe "editor.", ->
benchmark "move-to-beginning-of-word", ->
editor.moveCursorToBeginningOfWord()
editor.setCursorScreenPosition(endPosition)
describe "TokenizedBuffer.", ->
describe "coffee-script-grammar.", ->
[languageMode, buffer] = []
beforeEach ->
editSession = benchmarkFixturesProject.buildEditSessionForPath('medium.coffee')
{ languageMode, buffer } = editSession
pfbenchmark "construction", 5, ->
new TokenizedBuffer(buffer, { languageMode, tabText: ' '})