Skip to content

HTML escaper performance could be improved by adopting the same html escaping code as Svelte and Solid JS #46950

Closed as not planned
@cgranttm

Description

@cgranttm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: coreIssues related to the framework runtimearea: serverIssues related to server-side renderingbugcore: performance

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions