web playground: don't include editor.getValue() call in parse time
This commit is contained in:
parent
69ab405325
commit
fd80d60ae8
1 changed files with 6 additions and 7 deletions
|
|
@ -65,18 +65,17 @@ let tree;
|
|||
}
|
||||
|
||||
async function handleCodeChange(editor, changes) {
|
||||
let start;
|
||||
const newText = codeEditor.getValue() + '\n';
|
||||
|
||||
const start = performance.now();
|
||||
if (tree && changes) {
|
||||
start = performance.now();
|
||||
for (const change of changes) {
|
||||
const edit = treeEditForEditorChange(change);
|
||||
tree.edit(edit);
|
||||
tree.edit(treeEditForEditorChange(change));
|
||||
}
|
||||
} else {
|
||||
start = performance.now();
|
||||
}
|
||||
const newTree = parser.parse(codeEditor.getValue() + '\n', tree);
|
||||
const newTree = parser.parse(newText, tree);
|
||||
const duration = (performance.now() - start).toFixed(1);
|
||||
|
||||
updateTimeSpan.innerText = `${duration} ms`;
|
||||
if (tree) tree.delete();
|
||||
tree = newTree;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue