Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add ng_benchmark macro to run perf benchmarks (#33389)
this makes running and profiling tests much easier. Example usage: ``` yarn bazel run --define=compile=aot //packages/core/test/render3/perf:noop_change_detection ``` See README.md update for more info. PS: I considered moving the ng_rollup bundle into the macro but I didn't want to make too many changes in this PR. If we find running benchmarks in this way useful, we should refactor the build file more, and move the ng_rollup_bundle targets into the macro. PR Close #33389
- Loading branch information
1 parent
14c4b1b
commit 4b81bb5
Showing
4 changed files
with
111 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# 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 | ||
"""Bazel macro for running Angular benchmarks""" | ||
|
||
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary") | ||
|
||
def ng_benchmark(name, bundle): | ||
""" | ||
This macro creates two targets, one that is runnable and prints results and one that can be used for profiling via chrome://inspect. | ||
Args: | ||
name: name of the runnable rule to create | ||
bundle: label of the ng_rollup_bundle to run | ||
""" | ||
|
||
nodejs_binary( | ||
name = name, | ||
data = [bundle], | ||
entry_point = bundle + ".min_debug.es2015.js", | ||
tags = ["local"], | ||
) | ||
|
||
nodejs_binary( | ||
name = name + "_profile", | ||
data = [bundle], | ||
entry_point = bundle + ".min_debug.es2015.js", | ||
args = ["--node_options=--no-turbo-inlining --node_options=--inspect-brk"], | ||
tags = ["local"], | ||
) |