Skip to content

test(button-harness): add performance tests for buttons using the pro… #20222

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

Conversation

wagnermaciel
Copy link
Contributor

…tractor harness env

  • The main thing we are looking at here is not the button's performance. Instead we are looking at
    the performance overhead of using the protractor harness env.

@wagnermaciel wagnermaciel requested a review from a team as a code owner August 6, 2020 19:40
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Aug 6, 2020
@wagnermaciel wagnermaciel requested a review from mmalerba August 6, 2020 19:40
Copy link
Contributor

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

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

LGTM

@mmalerba mmalerba added action: merge The PR is ready for merge by the caretaker merge safe P2 The issue is important to a large percentage of users, with a workaround labels Aug 7, 2020
@wagnermaciel wagnermaciel removed the action: merge The PR is ready for merge by the caretaker label Aug 10, 2020
@wagnermaciel wagnermaciel removed P2 The issue is important to a large percentage of users, with a workaround merge safe labels Aug 14, 2020
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.

First drive-by review. Will have a more closer look as soon as possible.

* found in the LICENSE file at https://angular.io/license
*/

import {runBenchmark} from '@angular/dev-infra-private/benchmark/driver-utilities';
Copy link
Member

Choose a reason for hiding this comment

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

Are these utilities specific to button? Would it make more sense to put this into something higher, or even in dev-infra? At least as part of this PR it could be moved into test/benchmarks/utils?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, I'm not sure. I created the protractor and testbed benchmark utils so that their tests would be cleaner & simpler.

The testbed one uses console.warn which no other test is gonna want to use. The protractor one is more likely to be reusable since we might actually want to get the full time of a test instead of getting the sub-metrics returned by benchpress

I also think I need to go back and try to set up default params for runBenchmark again. I tried to do it a while back and surprisingly had a bunch of weird typescript errors throw

Do you think it would be sufficient to try and simplify the runBenchmark params instead?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think simplifying runBenchmark is what we want. I asked in the past for making ignoreBrowserSynchronization the default. I'd love us simplifying this.

Copy link
Member

Choose a reason for hiding this comment

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

Regardless of the runBenchmark API being simpler though; I think it might be good to move these shorthands (for using console.warn etc) into a higher-level because I assume we'll have more harness benchmarks, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe @mmalerba only needs this harness benchmark

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough. I didn't know this is the case. They sounded quite generic.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah these are not intended as performance tests for the button harness, they're intended as tests for the harness framework itself, they just happen to be using button to test that. I actually think we should change the directory name to make that more clear. How about test/benchmarks/cdk/testing/*?

Copy link
Member

Choose a reason for hiding this comment

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

That now makes sense 😄 thanks Miles for clarifying!

@wagnermaciel
Copy link
Contributor Author

@devversion Sorry, I should have left a comment. I pushed these changes out so that Miles could take a look. None of these changes are concrete right now

@devversion
Copy link
Member

devversion commented Aug 14, 2020

@wagnermaciel Oh, sorry! 😄 I got requested for review and looked since I didn't want people to be blocked on me 😛 Let me know if you want me to have a full look when it's done.

@wagnermaciel wagnermaciel force-pushed the protractor-harness-benchmark branch from 1fa517f to 72a4ae0 Compare August 17, 2020 21:33
@wagnermaciel
Copy link
Contributor Author

@devversion Ok, ready for review. My bad earlier, I should have let you know. And thanks for being so fast to review! I really value & appreciate your feedback!

* found in the LICENSE file at https://angular.io/license
*/

import {runBenchmark} from '@angular/dev-infra-private/benchmark/driver-utilities';
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think simplifying runBenchmark is what we want. I asked in the past for making ignoreBrowserSynchronization the default. I'd love us simplifying this.

* found in the LICENSE file at https://angular.io/license
*/

import {runBenchmark} from '@angular/dev-infra-private/benchmark/driver-utilities';
Copy link
Member

Choose a reason for hiding this comment

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

Regardless of the runBenchmark API being simpler though; I think it might be good to move these shorthands (for using console.warn etc) into a higher-level because I assume we'll have more harness benchmarks, right?

…tractor harness env

* The main thing we are looking at here is not the button's performance. Instead we are looking at
  the performance overhead of using the protractor and testbed harness env.
* We are running tests with & without the ProtractorHarnessEnvironment and with & without the
  TestbedHarnessEnvironment.
* We are benchmarking 5 operations with a varying number of buttons:
  1. Get the first button
  2. Click the first button
  3. Click the middle button
  4. Click the last button
  5. Click every button
Copy link
Contributor Author

@wagnermaciel wagnermaciel left a comment

Choose a reason for hiding this comment

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

@devversion I addressed most of your comments but I had trouble reconciling some of them with these changes requested by Miles (in particular, the naming of the tests)

mmalerba@eb8d037

* found in the LICENSE file at https://angular.io/license
*/

import {runBenchmark} from '@angular/dev-infra-private/benchmark/driver-utilities';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe @mmalerba only needs this harness benchmark


it('should click the first button', async () => {
await benchmark('click first button', async () => {
const button = await loader.getHarness(MatButtonHarness.with({text: FIRST_BUTTON}));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm going to address this along with the previous comment in my next commit (in this same PR)

I want to get the bulk of the changes in first before I work on consolidating the two tests into one shared spec, and I'll be making this fix as part of that change.

@wagnermaciel wagnermaciel force-pushed the protractor-harness-benchmark branch from bf160e8 to f847ab5 Compare September 1, 2020 19:04
@wagnermaciel wagnermaciel force-pushed the protractor-harness-benchmark branch from f847ab5 to 6cbd4d1 Compare September 1, 2020 19:05
Copy link
Contributor

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

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

Mostly looks good, I think we just need to change the directory name and re-work the protractor tests to look like the testbed ones

* found in the LICENSE file at https://angular.io/license
*/

import {runBenchmark} from '@angular/dev-infra-private/benchmark/driver-utilities';
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah these are not intended as performance tests for the button harness, they're intended as tests for the harness framework itself, they just happen to be using button to test that. I actually think we should change the directory name to make that more clear. How about test/benchmarks/cdk/testing/*?

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. Just the minor thinks Miles mentioned in his comment.

@wagnermaciel wagnermaciel added action: merge The PR is ready for merge by the caretaker merge safe target: patch This PR is targeted for the next patch release labels Sep 8, 2020
@andrewseguin andrewseguin merged commit 7177f3f into angular:master Sep 11, 2020
andrewseguin pushed a commit that referenced this pull request Sep 11, 2020
#20222)

* test(button-harness): add performance tests for buttons using the protractor harness env

* The main thing we are looking at here is not the button's performance. Instead we are looking at
  the performance overhead of using the protractor and testbed harness env.
* We are running tests with & without the ProtractorHarnessEnvironment and with & without the
  TestbedHarnessEnvironment.
* We are benchmarking 5 operations with a varying number of buttons:
  1. Get the first button
  2. Click the first button
  3. Click the middle button
  4. Click the last button
  5. Click every button

* fixup! test(button-harness): add performance tests for buttons using the protractor harness env

* fixup! test(button-harness): add performance tests for buttons using the protractor harness env

* fix(harness-benchmarks): lots of small changes

* fixup! fix(harness-benchmarks): lots of small changes

* refactor(harness-benchmarks): use hrtime instead of console.time

* move test to test/benchmarks/cdk/testing

* fix comment

(cherry picked from commit 7177f3f)
@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 Oct 12, 2020
@wagnermaciel wagnermaciel deleted the protractor-harness-benchmark 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 target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants