test(ivy): introduce a benchmark for duplicate style/class bindings (#33600)
Prior to this patch all the styling benchmarks only tested for template-based style/class bindings. Because of each of the bindings being only present in the template, there was no possibility of there being any duplicate bindings. This benchmark introduces style/class bindings being evaluated from both a template and from various directives. This benchmark can be executed by calling: ``` bazel build //packages/core/test/render3/perf:duplicate_style_and_class_bindings_lib.min_debug.es2015.js node dist/bin/packages/core/test/render3/perf/duplicate_style_and_class_bindings_lib.min_debug.es2015.js ``` The benchmark is also run via the `profile_all.js` script (found in `packages/core/test/render3/perf/`) PR Close #33600
This commit is contained in:

committed by
Andrew Scott

parent
8164d28b6c
commit
854a377232
23
packages/core/test/render3/perf/shared.ts
Normal file
23
packages/core/test/render3/perf/shared.ts
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {ɵɵdefineDirective} from '@angular/core/src/core';
|
||||
|
||||
import {HostBindingsFunction} from '../../../src/render3/interfaces/definition';
|
||||
|
||||
export function defineBenchmarkTestDirective(
|
||||
selector: string, hostBindings: HostBindingsFunction<any>, type?: any) {
|
||||
return ɵɵdefineDirective({
|
||||
hostBindings,
|
||||
type: type || FakeDirectiveType,
|
||||
selectors: [['', selector, '']],
|
||||
});
|
||||
}
|
||||
|
||||
class FakeDirectiveType {
|
||||
static ɵfac = () => { return {}; };
|
||||
}
|
Reference in New Issue
Block a user