Matias Niemelä 8d72a37f3e 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
2019-11-07 17:50:33 +00:00

24 lines
668 B
TypeScript

/**
* @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 {}; };
}