Visitar URL original
perf(core): guard i18n insertion assertion with ngDevMode by splincode 路 Pull Request #71256 路 angular/angular 路 GitHub
Skip to content

perf(core): guard i18n insertion assertion with ngDevMode - #71256

Open
splincode wants to merge 1 commit into
angular:mainfrom
splincode:perf/core-i18n-dev-assertion
Open

splincode wants to merge 1 commit into
angular:mainfrom
splincode:perf/core-i18n-dev-assertion

Conversation

@splincode

Copy link
Copy Markdown
Contributor

PR Checklist

This performance change uses the existing i18n tests and does not change a public API.

PR Type

  • Other: Performance

What is the current behavior?

setTNodeInsertBeforeIndex calls assertEqual(Array.isArray(insertBeforeIndex), ...) without an ngDevMode guard when appending to an i18n insertion array. The helper is used by the production i18n creation path, so the check and its assertion helpers can remain in optimized bundles.

What is the new behavior?

Guard the array invariant with ngDevMode, matching the adjacent assertions. Production optimization can remove the check while preserving development diagnostics and the array insertion.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

The isolated AOT i18n control used published @angular/core@22.3.0-next.0 FESMs with this one-line change applied, the @angular/build@22.2.0 JavaScript optimizer, and esbuild 0.28.2. Production flags were set to false; RxJS and the compiler were external.

Output Before After Reduction
Minified JS 74,538 B 74,334 B 204 B
gzip 27,375 B 27,264 B 111 B

This is a fixture-specific bundle measurement, not a full Angular CLI application build.

Guard the array invariant in setTNodeInsertBeforeIndex so production
bundles can remove the check and its assertion helpers. Keep the
existing development diagnostics and array insertion behavior.
@pullapprove
pullapprove Bot requested a review from atscott October 8, 2026 12:19
@angular-robot angular-robot Bot added area: performance Issues related to performance area: core Issues related to the framework runtime labels Oct 8, 2026
@ngbot ngbot Bot added this to the Backlog milestone Oct 8, 2026
@JeanMeche

Copy link
Copy Markdown
Member

This is also shows that we don't have great coverage for i18n, this should have broken a symbol test (that would have shown that we have this assert function in a prod bundle)

@JeanMeche
JeanMeche removed the request for review from atscott October 8, 2026 13:53
@JeanMeche JeanMeche added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime area: performance Issues related to performance target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants