Skip to content

Conversation

@halfnelson
Copy link
Contributor

jasonlyu09 from discord discovered Svelte's parse method is very slow when scripts contain lots of whitespace.

We assume it is something to do with a regex that cleans trailing spaces. (may be similar to this sindresorhus/trim-right#3)

Instead of changing the regex in svelte, we just stop making too much white space by introducing /**/ comments at the end of lines when blanking out the script tag.

Added a test.

With fix:
image

Without fix:
image

Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

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

👍
FYI @jasonlyu123

@dummdidumm dummdidumm merged commit 5e54e26 into sveltejs:master Nov 5, 2020
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