Skip to content

Conversation

JeanMeche
Copy link
Member

No description provided.

@alan-agius4
Copy link
Collaborator

@jkrems
Copy link
Contributor

jkrems commented Mar 30, 2025

Is this in reference to:

The easiest way to do so is by minifying your source code, stripping out unnecessary whitespace, and to avoid non-ASCII identifiers where possible.

I would've read this as:

"The identifier a (latin a) looks the same length as α (greek alpha) but the scanner needs to look at one instead of two bytes to parse a. You should prefer ASCII identifiers to reduce the number of source bytes."

Turning ɵ (2 UTF8 bytes) into \u0275 (6 bytes) sounds like it would make things slower rather than faster? Or are escape sequences faster than reading the literal characters? Intuitively, escape sequences should require more parsing because they involve number parsing, string-to-number, followed by collapsing that number back into a different string. Potentially also more allocation things because it can't just "slice off" the identifier name from the source string.

@alan-agius4
Copy link
Collaborator

From the article I get that biggest overhead is actually pre parsing phase, "Strings and identifiers that cannot be encoded in Latin1 are currently more expensive since we first try to buffer them as Latin1, converting them to UTF-16 once we encounter a character that cannot be encoded in Latin1."

I do not fully recall all the details but I remember that we (I think it was Keen who did this) had chats with the Chrome team and as far as I recall they confirmed that we should use ascii whenever possible, and we switched to ascii years ago with webpack and terser It also seems to be one of the motivations why esbuild outputs ascii by default https://esbuild.github.io/api/#charset.

//cc @clydin maybe he remembers some more details.

@jkrems
Copy link
Contributor

jkrems commented Mar 31, 2025

Interesting! Thanks for the details. Forgot the latin1 of it all. :)

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants