You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 56683ea
Browse filesBrowse the repository at this point in the historyBrowse files
perf(compiler): write non-ASCII SSR template text as character references (#4331)
* perf(compiler): write non-ASCII SSR template text as character references
One character above U+00FF in a static SSR template, such as the arrow
in `<a>View →</a>`, made V8 store the whole rendered page as a two-byte
string, which roughly doubled the cost of flattening it and encoding it
to UTF-8. Both compilers now write those characters in static text and
quoted attribute values as numeric character references, including the
static attributes baked into a spread element's attribute string.
Latin-1 characters stay literal, since they already fit a one-byte
string and `€` through `Ÿ` decode to other characters. Tag
internals, comments, raw-text bodies and the children of a spread
`<script>` or `<style>` keep their characters, because browsers do not
decode references there.
Fixes#4328
* fix(compiler): keep spread raw-text element children and quotes raw
Element children of a spread raw-text element such as `<xmp {...p}>`
now keep their characters in the Rust compiler, matching Babel. In both
compilers a quote opens an attribute value only after `=`, and
`<plaintext>` is treated as raw text to the end of the template.
SSR templates write characters above U+00FF in static text and quoted attribute values as numeric character references (`→` becomes `→`), as do the static attributes baked into a spread element's attribute string. One character above U+00FF in a template made V8 store the whole rendered page as a two-byte string, which roughly doubled the cost of flattening and UTF-8 encoding the response (#4328). Latin-1 characters stay literal. Tag internals, comments, raw-text bodies such as `<script>` and `<style>`, and the children of a spread `<script>` or `<style>` keep their characters, since browsers do not decode references there. Client output is unchanged.
0 commit comments