Add benchmark for TokenizedBuffer w/ new TextMateGrammar tokenization. SO SLOW!

This commit is contained in:
Nathan Sobo 2012-08-06 18:28:51 -06:00
parent 6878d19a6a
commit a02af2a51f
2 changed files with 21 additions and 2 deletions

View File

@ -4,9 +4,14 @@ _ = require 'underscore'
Keymap = require 'keymap'
Point = require 'point'
RootView = require 'root-view'
Project = require 'project'
TextMateBundle = require 'text-mate-bundle'
require 'window'
requireStylesheet "jasmine.css"
TextMateBundle.loadAll()
RootView.prototype.loadUserConfiguration = ->
keymap = new Keymap
@ -24,6 +29,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: ' '})