angular-cn/packages/core/test/render3
Kristiyan Kostadinov 11cd37fae3 fix(core): not invoking object's toString when rendering to the DOM (#39843)
Currently we convert objects to strings using `'' + value` which is quickest,
but it stringifies the value using its `valueOf`, rather than `toString`. These
changes switch to using `String(value)` which has identical performance
and calls the `toString` method as expected. Note that another option
was calling `toString` directly, but benchmarking showed it to be slower.

I've included the benchmark I used to verify the performance so we have it
for future reference and we can reuse it when making changes to `renderStringify`
in the future.

Also for reference, here are the results of the benchmark:

```
Benchmark: renderStringify
 concat: 2.006 ns(0%)
 concat with toString: 2.201 ns(-10%)
 toString: 237.494 ns(-11741%)
 toString with toString: 121.072 ns(-5937%)
 constructor: 2.201 ns(-10%)
 constructor with toString: 2.201 ns(-10%)
 toString mono: 14.536 ns(-625%)
 toString with toString mono: 9.757 ns(-386%)
```

Fixes #38839.

PR Close #39843
2020-11-30 15:49:57 -08:00
..
i18n fix(compiler): treat i18n attributes with no bindings as static attributes (#39408) 2020-10-27 13:31:29 -07:00
instructions refactor(core): Consistent use of `HEADER_OFFSET` (in `ɵɵ*` instructions only) (#39233) 2020-10-21 18:33:00 -07:00
interfaces refactor(core): Create `TNodeType.Text` to display full template in `TView` debug (#39233) 2020-10-21 18:33:00 -07:00
ivy refactor(core): remove unused fakeAsyncFallback and asyncFallback (#37879) 2020-11-20 08:34:59 -08:00
jit build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
perf fix(core): not invoking object's toString when rendering to the DOM (#39843) 2020-11-30 15:49:57 -08:00
styling_next refactor(core): Ensure that `previousOrParentTNode` always belongs to current `TView`. (#38707) 2020-09-28 16:15:58 -04:00
util build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
BUILD.bazel refactor(core): remove unused fakeAsyncFallback and asyncFallback (#37879) 2020-11-20 08:34:59 -08:00
change_detection_spec.ts fix(core): markDirty() should only mark flags when really scheduling tick. (#39316) 2020-10-29 16:07:10 -07:00
common_with_def.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
component_ref_spec.ts refactor(core): clean up circular dependencies (#39722) 2020-11-18 09:15:29 -08:00
component_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
di_spec.ts refactor(core): add top 10 runtime error codes (#39188) 2020-10-28 10:05:01 -07:00
domino.d.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
global_utils_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
i18n_debug_spec.ts refactor(core): cleanup i18n/icu data structures (#39233) 2020-10-21 18:33:00 -07:00
imported_renderer2.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
instructions_spec.ts refactor(core): Change `TemplateFixture` to named parameters (#39233) 2020-10-21 18:32:59 -07:00
integration_spec.ts refactor(core): clean up circular dependencies (#39722) 2020-11-18 09:15:29 -08:00
is_shape_of.ts refactor(core): Replace `ExpandoInstructions` with `HostBindingOpCodes` (#39301) 2020-10-22 09:35:48 -07:00
is_shape_of_spec.ts refactor(core): add debug ranges to `LViewDebug` with matchers (#38359) 2020-08-06 16:58:11 -07:00
jit_environment_spec.ts feat(compiler-cli): support for partial compilation of components (#39707) 2020-11-24 13:05:49 -08:00
listeners_spec.ts refactor(core): Consistent use of `HEADER_OFFSET` (in `ɵɵ*` instructions only) (#39233) 2020-10-21 18:33:00 -07:00
load_domino.ts refactor(core): remove unused fakeAsyncFallback and asyncFallback (#37879) 2020-11-20 08:34:59 -08:00
matchers.ts refactor(core): cleanup i18n/icu data structures (#39233) 2020-10-21 18:33:00 -07:00
matchers_spec.ts refactor(core): Consistent use of `HEADER_OFFSET` (in `ɵɵ*` instructions only) (#39233) 2020-10-21 18:33:00 -07:00
metadata_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
node_selector_matcher_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
perfCounter_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
pipe_spec.ts refactor(core): Change `TemplateFixture` to named parameters (#39233) 2020-10-21 18:32:59 -07:00
providers_spec.ts perf(core): do not recurse into modules that have already been registered (#39514) 2020-11-02 07:51:18 -08:00
query_spec.ts docs: update links to use HTTPS as protocol (#39718) 2020-11-20 12:52:16 -08:00
render_util.ts fix(core): remove duplicated noop function (#39761) 2020-11-19 12:14:12 -08:00
renderer_factory_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
testing_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
utils.ts refactor(core): Rename `debugMatch` to `matchDebug` for consistency (#39233) 2020-10-21 18:33:00 -07:00
view_container_ref_spec.ts refactor(core): clean up circular dependencies (#39722) 2020-11-18 09:15:29 -08:00
view_fixture.ts fix(core): Store ICU state in `LView` rather than in `TView` (#39233) 2020-10-21 18:33:00 -07:00
view_utils_spec.ts fix(core): Store ICU state in `LView` rather than in `TView` (#39233) 2020-10-21 18:33:00 -07:00