Skip to content
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

Disable throttling for non-performance passes #1740

Merged
merged 4 commits into from
Feb 23, 2017
Merged

Conversation

paulirish
Copy link
Member

@paulirish paulirish commented Feb 17, 2017

This is the approach that I ended up with after playing around a bit.

  • useThrottling prop in the config for each pass
  • if that is true and the disable CLI flags aren't set, then we'll turn it on.
  • if the prop is false for a pass we'll definitely make sure throttling is off
  • when goOnline comes back it'll restore whatever throttling should be for that pass.
  • setThrottling method in driver does the work. the old beginEmulation now defers to it for some parts.

wdyt?

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

I like the overall approach and love the speedup!

@@ -673,21 +673,31 @@ class Driver {
return this.sendCommand('Runtime.enable');
}

beginEmulation(flags) {
beginEmulation(options) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

any reason to switch from flags to options? looks like this just uses flags

const emulations = [];

if (!flags.disableDeviceEmulation) {
emulations.push(emulation.enableNexus5X(this));
if (!passConfig.useThrottling) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is one case I think having it nested would make it more readable, took me a bit to spot the early return (though that may be more diff noise and it's easier without the diff)

thoughts on the following?

if (useThrottling) {
  if (!disableNetwork) emulations.push()
  if (!disableCpu) emulations.push
} else {
  emulations.push(...)
}

return Promise.all()

Copy link
Member Author

Choose a reason for hiding this comment

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

so much better. done.

return this.sendCommand('Network.enable')
.then(_ => emulation.goOffline(this))
.then(_ => {
this.online = false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: could probably one-line this too

});
}

setThrottling(cliFlags, passConfig) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should passConfig just be a boolean, useThrottling?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, see you're passing in the options.config below. Guess it's fine.

@paulirish paulirish force-pushed the throttleallthetime branch 2 times, most recently from 12ae6de to d81792a Compare February 23, 2017 03:14
Copy link
Member Author

@paulirish paulirish left a comment

Choose a reason for hiding this comment

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

PTAL. updated.

@patrickhulce good call inverting the conditional. much better now.

const emulations = [];

if (!flags.disableDeviceEmulation) {
emulations.push(emulation.enableNexus5X(this));
if (!passConfig.useThrottling) {
Copy link
Member Author

Choose a reason for hiding this comment

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

so much better. done.

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

nice

@paulirish paulirish merged commit dd994d9 into master Feb 23, 2017
@paulirish paulirish deleted the throttleallthetime branch February 23, 2017 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants