Skip to content

feat(benchmarks): setup for benchmarking components #19320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2020

Conversation

wagnermaciel
Copy link
Contributor

Summary

  • Set up components repo to use dev-infra benchmarking tools
  • Create first set of benchmark tests for mat-checkbox

Current Workaround

This change depends on two changes to angular/angular.

  1. PR #36800
  2. The resolution of Issue #36986

Until those changes have been made, the current workaround is to

  1. Checkout the working branch for PR #36800
  2. Fix Issue #36986
  3. Run yarn bazel build //dev-infra:npm_package.pack to create a local version of dev-infra

This workaround allows us to change the package.json in angular/components to depend on the files from this locally published version of dev-infra.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label May 11, 2020
@wagnermaciel wagnermaciel force-pushed the feat/benchpress branch 2 times, most recently from 8bd51e5 to 62182c2 Compare June 4, 2020 00:42
@wagnermaciel wagnermaciel force-pushed the feat/benchpress branch 4 times, most recently from 6504d50 to 1fd3d2c Compare June 4, 2020 17:55
@wagnermaciel wagnermaciel marked this pull request as ready for review June 4, 2020 18:16
@wagnermaciel wagnermaciel requested a review from a team as a code owner June 4, 2020 18:16
@wagnermaciel wagnermaciel force-pushed the feat/benchpress branch 2 times, most recently from ddddc80 to 0f41f98 Compare June 4, 2020 18:53
Copy link
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. A few minor comments

</ng-container>
`,
encapsulation: ViewEncapsulation.None,
styleUrls: ['//src/material/core/theming/prebuilt/indigo-pink.css'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you confirm if that actually works? I wouldn't know of any resolution code that supports Bazel labels.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devversion Yeah, it works. Removing it breaks the styles. Kinda strange now that you mention it... @jelbourn Does styleUrls supports Bazel labels? lol

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea how this would work. @devversion and @wagnermaciel could you pair to figure out the best way to set this up?

Copy link
Member

@devversion devversion Jun 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you think about the impact of using styleUrls for that? couldn't it affect benchmarks in creation phase as the theme styles are actually loading deferred as part of the runtime JS while we'd be actually only interested in the test component in isolation?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checked. It works only with ngtsc (so not with View Engine) because ngtsc normalizes the path so that double-slash (as per Bazel label) becomes a path. That path is then matched against rootDirs of the TS program. bazel-out is a root directory, so the prebuilt theme can be resolved. That is reasonable (with the downside of not working for --config=view-engine).

Regardless of that though, I think we should not load the theme as part of the component factory. That will cause deviations in benchmarks as the theme will be loaded deferred and through Angular. I still think we should implement asset injection.

I think we could merge this in the interim. Asset injection would require upstream changes in dev-infra. @wagnermaciel Happy to jump on a call to explain what I refer to with asset injection

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That explains it! Yeah, I agree that we can leave this for now and change it to an asset in a follow-up. @wagnermaciel can you add a TODO and file an issue for yourself?

Copy link
Contributor Author

@wagnermaciel wagnermaciel Jun 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done and done. Here's the todo and I created this issue in angular/angular.

</ng-container>
`,
encapsulation: ViewEncapsulation.None,
styleUrls: ['//src/material/core/theming/prebuilt/indigo-pink.css'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea how this would work. @devversion and @wagnermaciel could you pair to figure out the best way to set this up?

@jelbourn jelbourn added the target: patch This PR is targeted for the next patch release label Jun 4, 2020
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jelbourn jelbourn added lgtm action: merge The PR is ready for merge by the caretaker merge: fix commit message When the PR is merged, rewrites/fixups of the commit messages are needed labels Jun 4, 2020
* Set up components repo to use dev-infra benchmarking tools
* Created first set of benchmark tests for mat-checkbox
* Import indigo-pink.scss via the components styleUrls
* Set the view encapsulation of the component to none so that the styles from indigo-pink.scss are applied to the whole page
* Left a todo in WORKSPACE to remember to deduplicate browsers
* Left a todo in the checkbox benchmark's BUILD file to remember to update the component_benchmark once the desired changes are made
@wagnermaciel wagnermaciel removed the merge: fix commit message When the PR is merged, rewrites/fixups of the commit messages are needed label Jun 4, 2020
@jelbourn jelbourn added target: major This PR is targeted for the next major release merge: fix commit message When the PR is merged, rewrites/fixups of the commit messages are needed and removed target: patch This PR is targeted for the next patch release labels Jun 5, 2020
@jelbourn jelbourn merged commit 9716a01 into angular:master Jun 5, 2020
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 6, 2020
@wagnermaciel wagnermaciel deleted the feat/benchpress branch January 14, 2021 19:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement merge: fix commit message When the PR is merged, rewrites/fixups of the commit messages are needed target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants