-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
test(button-harness): add performance tests for buttons using the pro… #20222
Conversation
test/benchmarks/material/button-harness/protractor.perf-spec.ts
Outdated
Show resolved
Hide resolved
test/benchmarks/material/button-harness/protractor.perf-spec.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this 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.
test/benchmarks/material/button-harness/protractor.perf-spec.ts
Outdated
Show resolved
Hide resolved
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {runBenchmark} from '@angular/dev-infra-private/benchmark/driver-utilities'; |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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/*
?
There was a problem hiding this comment.
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!
@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 |
@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. |
1fa517f
to
72a4ae0
Compare
@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'; |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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?
test/benchmarks/material/button-harness/protractor-benchmark-utilities.ts
Outdated
Show resolved
Hide resolved
test/benchmarks/material/button-harness/protractor-benchmark-utilities.ts
Outdated
Show resolved
Hide resolved
test/benchmarks/material/button-harness/protractor.perf-spec.ts
Outdated
Show resolved
Hide resolved
…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
…the protractor harness env
…the protractor harness env
There was a problem hiding this 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)
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {runBenchmark} from '@angular/dev-infra-private/benchmark/driver-utilities'; |
There was a problem hiding this comment.
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
test/benchmarks/material/button-harness/protractor.perf-spec.ts
Outdated
Show resolved
Hide resolved
|
||
it('should click the first button', async () => { | ||
await benchmark('click first button', async () => { | ||
const button = await loader.getHarness(MatButtonHarness.with({text: FIRST_BUTTON})); |
There was a problem hiding this comment.
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.
bf160e8
to
f847ab5
Compare
f847ab5
to
6cbd4d1
Compare
There was a problem hiding this 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'; |
There was a problem hiding this comment.
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/*
?
There was a problem hiding this 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.
#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)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
…tractor harness env
the performance overhead of using the protractor harness env.