angular/packages/compiler/src/ml_parser
JoostK 5d871b56c6 perf(compiler): optimize cloning cursors state (#34332)
On a large compilation unit with big templates, the total time spent in
the `PlainCharacterCursor` constructor was 470ms. This commit applies
two optimizations to reduce this time:

1. Avoid the object spread operator within the constructor, as the
generated `__assign` helper in the emitted UMD bundle (ES5) does not
optimize well compared to a hardcoded object literal. This results in a
significant performance improvement. Because of the straight-forward
object literal, the VM is now much better able to optimize the memory
allocations which makes a significant difference as the
`PlainCharacterCursor` constructor is called in tight loops.

2. Reduce the number of `CharacterCursor` clones. Although cloning
itself is now much faster because of the optimization above, several
clone operations were not necessary.

Combined, these changes reduce the total time spent in the
`PlainCharacterCursor` constructor to just 10ms.

PR Close #34332
2019-12-12 14:06:38 -08:00
..
ast.ts refactor(compiler): add abstract NodeWithI18n class to ML parsing (#33318) 2019-10-22 13:30:16 -04:00
html_parser.ts refactor(compiler): use options argument for parsers (#28055) 2019-02-12 20:58:27 -08:00
html_tags.ts fix(core): don't wrap <tr> and <col> elements into a required parent (#29219) 2019-03-14 03:07:01 -04:00
html_whitespaces.ts fix(compiler): do not remove whitespace wrapping i18n expansions (#31962) 2019-08-09 12:03:50 -07:00
icu_ast_expander.ts docs: fix spelling 2017-03-22 21:28:24 -07:00
interpolation_config.ts build: update npm dependencies (#19328) 2017-09-22 13:20:52 -07:00
lexer.ts perf(compiler): optimize cloning cursors state (#34332) 2019-12-12 14:06:38 -08:00
parser.ts fix(core): don't wrap <tr> and <col> elements into a required parent (#29219) 2019-03-14 03:07:01 -04:00
tags.ts fix(core): don't wrap <tr> and <col> elements into a required parent (#29219) 2019-03-14 03:07:01 -04:00
xml_parser.ts refactor(compiler): use options argument for parsers (#28055) 2019-02-12 20:58:27 -08:00
xml_tags.ts build(bazel): Turning on strictPropertyInitialization for Angular. (#24572) 2018-06-25 07:57:13 -07:00