-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a
TextEditor
benchmark for large files construction
- Loading branch information
Antonio Scandurra
committed
Oct 14, 2016
1 parent
40d9bc7
commit bb0a0cd
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** @babel */ | ||
|
||
import fs from 'fs' | ||
import temp from 'temp' | ||
import {TextEditor, TextBuffer} from 'atom' | ||
|
||
export default function () { | ||
const data = [] | ||
const maxLineCount = 10000 | ||
const step = 500 | ||
const lineText = 'Lorem ipsum dolor sit amet\n' | ||
const sampleText = lineText.repeat(maxLineCount) | ||
for (let lineCount = 0; lineCount <= maxLineCount; lineCount += step) { | ||
const text = sampleText.slice(0, lineText.length * lineCount) | ||
const buffer = new TextBuffer(text) | ||
const t0 = window.performance.now() | ||
const editor = new TextEditor({buffer, largeFileMode: true}) | ||
document.body.appendChild(editor.element) | ||
const t1 = window.performance.now() | ||
data.push({name: 'Opening and rendering a TextEditor', x: lineCount, duration: t1 - t0}) | ||
editor.element.remove() | ||
editor.destroy() | ||
} | ||
return data | ||
} |