angular-cn/packages/compiler/test/i18n
JoostK 604b4e46c8 perf(compiler): optimize computation of i18n message ids (#39694)
Message ID computation makes extensive use of big integer
multiplications in order to translate the message's fingerprint into
a numerical representation. In large compilations with heavy use of i18n
this was showing up high in profiler sessions.

There are two factors contributing to the bottleneck:

1. a suboptimal big integer representation using strings, which requires
repeated allocation and conversion from a character to numeric digits
and back.
2. repeated computation of the necessary base-256 exponents and their
multiplication factors.

The first bottleneck is addressed using a representation that uses an
array of individual digits. This avoids repeated conversion and
allocation overhead is also greatly reduced, as adding two big integers
can now be done in-place with virtually no memory allocations.

The second point is addressed by a memoized exponentiation pool to
optimize the multiplication of a base-256 exponent.

As an additional optimization are the two 32-bit words now converted to
decimal per word, instead of going through an intermediate byte buffer
and doing the decimal conversion per byte.

The results of these optimizations depend a lot on the number of i18n
messages for which a message should be computed. Benchmarks have shown
that computing message IDs is now ~6x faster for 1,000 messages, ~14x
faster for 10,000 messages, and ~24x faster for 100,000 messages.

PR Close #39694
2020-11-17 10:09:28 -08:00
..
serializers fix(compiler-cli): compute source-mappings for localized strings (#38645) 2020-09-08 13:17:21 -07:00
big_integer_spec.ts perf(compiler): optimize computation of i18n message ids (#39694) 2020-11-17 10:09:28 -08:00
digest_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
extractor_merger_spec.ts refactor(compiler): `element.sourceSpan` should span the `outerHTML` (#38581) 2020-09-02 14:47:31 -07:00
i18n_html_parser_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
i18n_parser_spec.ts refactor(compiler): associate accurate source spans with ICU expressions (#39072) 2020-10-08 11:55:27 -07:00
integration_common.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
integration_xliff2_spec.ts feat(core): update reference and doc to change `async` to `waitAsync`. (#37583) 2020-08-03 12:54:13 -07:00
integration_xliff_spec.ts feat(core): update reference and doc to change `async` to `waitAsync`. (#37583) 2020-08-03 12:54:13 -07:00
integration_xmb_xtb_spec.ts feat(core): update reference and doc to change `async` to `waitAsync`. (#37583) 2020-08-03 12:54:13 -07:00
message_bundle_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
translation_bundle_spec.ts refactor(compiler): associate accurate source spans with ICU expressions (#39072) 2020-10-08 11:55:27 -07:00