HTML escaper performance could be improved by adopting the same html escaping code as Svelte and Solid JS #46950
Labels
area: core
Issues related to the framework runtime
area: server
Issues related to server-side rendering
bug
core: performance
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Milestone
Which @angular/* package(s) are relevant/related to the feature request?
platform-browser
Description
The html escape function provided in @angular/platform-browser is outperformed by newer takes on it from Solid JS and Svelte. packages\platform-browser\src\browser\transfer_state.ts
Proposed solution
Consider adopting the same method as Svelte for escaping html. The code can be found here: sveltejs/svelte#5701 Also here's a js bench comparing the two functions for store serialisation. I made a js bench comparing the old/new approach, it needs this gist to be in the setup data: https://gist.github.com/callumelgrant/dde6f54cd1544c1be5524a74b5365cd6 https://jsbench.me/uyl5xdwloa/1
Alternatives considered
It could be possible to make an even faster one than Svelte's.
The text was updated successfully, but these errors were encountered: