Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(perf) WIP: TS incremental parsing #1192

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Conversation

dummdidumm
Copy link
Member

@dummdidumm dummdidumm commented Oct 3, 2021

Implement getChangeRange of the ScriptSnapshot interface so TS can incrementally parse the result of svelte2tsx.
TODO:

  • Doesn't reliably work, gets into a broken state seemginly random after some time Update: Found a bug in the implementation, works now
  • Wasn't able to prove this is really faster (how to best test this?). Update: Tested this with VS Code's Dev Tools and it doesn't change much. It's about 2-5miliseconds that are saved, which feels like very little. @jasonlyu123 thoughts?

dummdidumm and others added 4 commits October 3, 2021 11:20
Implement getChangeRange of the ScriptSnapshot interface so TS can incrementally parse the result of svelte2tsx.
TODO:
- Doesn't reliably work, gets into a broken state seemginly random after some time
- Wasn't able to prove this is really faster (how to best test this?)

let diffStart = oldText.length - 1;
for (let i = 0; i < currentText.length; i++) {
if (oldText.charAt(i) !== currentText.charAt(i)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably better to use charCodeAt. chatAt will likely allocate intermediate strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants