svelte
svelte copied to clipboard
fix #3586 comments instead of empty text nodes (perf)
Comment nodes are much faster - no styles, drawing etc...
fix #3586
Before submitting the PR, please make sure you do the following
- [x] It's really useful if your PR relates to an outstanding issue, so please reference it in your PR, or create an explanatory one for discussion. In many cases features are absent for a reason.
- [x] This message body should clearly illustrate what problems it solves. If there are related issues, remember to reference them.
- [x] Ideally, include a test that fails without this PR but passes with it. PRs will only be merged once they pass CI. (Remember to
npm run lint
!)
Tests
- [x] Run the tests tests with
npm test
oryarn test
)
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I think this is a good idea. The vast majority of the comments on the linked issue support this change. The only possible hesitation was that text nodes are less cluttered when you open devtools - though I somewhat think the clutter is a good thin as it makes it clear what Svelte it doing and provides impetus for making it stop creating lots of empty text nodes. In the meantime, this is better performance
I think using comment nodes would spam the browser elements view quite a bit. I feel like we should investigate using fewer of those empty text nodes instead.
I would love to see this change land as part of a dev vs prod style flagging system where the output in prod mode is allowed to be a bit uglier for the sake of speed/size/etc.