test(core): add micro benchmarks for i18n scenarios (#39142)
This commit adds micro benchmarks to run micro benchmarks for i18n-related logic in the following scenarios: - i18n static attributes - i18n attributes with interpolations - i18n blocks of static text - i18n blocks of text + interpolations - simple ICUs - nested ICUs First 4 scenarios also have baseline scenarios (non-i18n) so that we can compare i18n perf with non-i18n logic. PR Close #39142
This commit is contained in:
@@ -48,3 +48,4 @@ export * from './class_map_interpolation';
|
||||
export * from './style_map_interpolation';
|
||||
export * from './style_prop_interpolation';
|
||||
export * from './host_property';
|
||||
export * from './i18n';
|
||||
|
||||
@@ -17,7 +17,7 @@ import {HEADER_OFFSET} from '../interfaces/view';
|
||||
import {getLView, getTView, nextBindingIndex} from '../state';
|
||||
import {getConstant} from '../util/view_utils';
|
||||
|
||||
import {setDelayProjection} from './all';
|
||||
import {setDelayProjection} from './projection';
|
||||
|
||||
/**
|
||||
* Marks a block of text as translatable.
|
||||
|
||||
@@ -230,6 +230,19 @@ ng_benchmark(
|
||||
bundle = ":host_binding",
|
||||
)
|
||||
|
||||
ng_rollup_bundle(
|
||||
name = "i18n_lib",
|
||||
entry_point = ":i18n/index.ts",
|
||||
deps = [
|
||||
":perf_lib",
|
||||
],
|
||||
)
|
||||
|
||||
ng_benchmark(
|
||||
name = "i18n",
|
||||
bundle = ":i18n",
|
||||
)
|
||||
|
||||
ng_rollup_bundle(
|
||||
name = "view_destroy_hook_lib",
|
||||
entry_point = ":view_destroy_hook/index.ts",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,8 @@
|
||||
import {ProceduralRenderer3, RComment, RElement, Renderer3, RendererFactory3, RendererStyleFlags3, RNode, RText} from '../../../src/render3/interfaces/renderer';
|
||||
|
||||
export class MicroBenchmarkRenderNode implements RNode, RComment, RText {
|
||||
tagName?: string;
|
||||
nodeType?: number;
|
||||
textContent: string|null = null;
|
||||
parentNode: RNode|null = null;
|
||||
parentElement: RElement|null = null;
|
||||
@@ -43,7 +45,7 @@ export class MicroBenchmarkRenderer implements ProceduralRenderer3 {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
parentNode(node: RNode): RElement|null {
|
||||
throw new Error('Method not implemented.');
|
||||
return null;
|
||||
}
|
||||
nextSibling(node: RNode): RNode|null {
|
||||
throw new Error('Method not implemented.');
|
||||
|
||||
@@ -1,18 +1,25 @@
|
||||
<html>
|
||||
<script>
|
||||
let BASE = location.toString().split('packages/core/test/render3/perf')[0]
|
||||
let BENCHMARK = location.search.split('=')[1];
|
||||
document.writeln('<' + 'script src="' + BASE + '/dist/bin/packages/core/test/render3/perf/' + BENCHMARK + '.min_debug.js"></' + 'script>');
|
||||
</script>
|
||||
<body>
|
||||
<ol>
|
||||
<li>Build the benchmark using <tt>yarn bazel build //packages/core/test/render3/perf:${BENCHMARK}.min_debug.js --config=ivy</tt></li>
|
||||
<li>Open this file using the <tt>file://</tt> protocol and add <tt>?benchmark=BENCHMARK</tt> to the URL.</li>
|
||||
<li>
|
||||
Note: You should likely run this in an incognito browser with the "no-turbo-inlining" flag.<br />
|
||||
On Chrome, the command would be <code>/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome -incognito --js-flags="--no-turbo-inlining"</code>
|
||||
</li>
|
||||
<li>Open debug console for details. Benchmark profiles are available in the "JavaScript Profiler" tab of Chrome DevTools.</li>
|
||||
</ol>
|
||||
</body>
|
||||
<script>
|
||||
let BASE = location.toString().split('packages/core/test/render3/perf')[0]
|
||||
let BENCHMARK = location.search.split('=')[1];
|
||||
document.writeln('<' + 'script src="' + BASE + '/dist/bin/packages/core/test/render3/perf/' + BENCHMARK +
|
||||
'_lib.min_debug.js"></' + 'script>');
|
||||
|
||||
</script>
|
||||
|
||||
<body>
|
||||
<ol>
|
||||
<li>Build the benchmark using <tt>yarn bazel build //packages/core/test/render3/perf:${BENCHMARK}.min_debug.js
|
||||
--config=ivy</tt></li>
|
||||
<li>Open this file using the <tt>file://</tt> protocol and add <tt>?benchmark=BENCHMARK</tt> to the URL.</li>
|
||||
<li>
|
||||
Note: You should likely run this in an incognito browser with the "no-turbo-inlining" flag.<br />
|
||||
On Chrome, the command would be <code>/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome -incognito
|
||||
--js-flags="--no-turbo-inlining"</code>
|
||||
</li>
|
||||
<li>Open debug console for details. Benchmark profiles are available in the "JavaScript Profiler" tab of Chrome
|
||||
DevTools.</li>
|
||||
</ol>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user