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

fix: remove afterPass throttling #1901

Merged
merged 2 commits into from
Mar 28, 2017
Merged

Conversation

patrickhulce
Copy link
Collaborator

@patrickhulce patrickhulce commented Mar 24, 2017

Copy link
Collaborator

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

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

looks allright, not the biggest change

@patrickhulce
Copy link
Collaborator Author

@brendankenny does this address your concern from #1868?

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

looks good.

I was not a fan of this idea when I originally wrote that comment--seemed too easy to accidentally write code that you think should be throttled but won't be--but thinking about it since, it makes a certain amount of sense that just like afterPass is after tracing that it also be after throttling.

It does mean that a gatherer can't be throttled and avoid the overhead of tracing (depending on which pass it ends up in), but really the only reason you'd want to be throttled is to measure the effect of throttling on some normal action, so I'd imagine the need for that would be rare. We can always add a new pass stage if we ever somehow need that.

This also makes me think throttling should also be applied after beforePass runs for symmetry and easy reasoning about gatherer life cycles, but we can wait on that.

const useCpuThrottling = passConfig.useThrottling && !flags.disableCpuThrottling;
const useNetworkThrottling = passConfig.useThrottling && !flags.disableNetworkThrottling;
const cpuThrottleFunc = `${useCpuThrottling ? 'enable' : 'disable'}CPUThrottling`;
const networkThrottleFunc = `${useNetworkThrottling ? 'enable' : 'disable'}NetworkThrottling`;
Copy link
Member

@brendankenny brendankenny Mar 27, 2017

Choose a reason for hiding this comment

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

string construction is pretty bad, but so was the original :P

Short of a refactor of emulation.js, what about

setThrottling(flags, passConfig) {
  const throttleCpu = passConfig.useThrottling && !flags.disableCpuThrottling;
  const cpuPromise = throttleCpu ? emulation.enableCPUThrottling(this) :
      emulation.disableCPUThrottling(this);

  const throttleNetwork = passConfig.useThrottling && !flags.disableNetworkThrottling;
  const networkPromise = throttleNetwork ? emulation.enableNetworkThrottling(this) :
      emulation.disableCPUThrottling(this);

  return Promise.all([cpuPromise, networkPromise]);
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure

@@ -244,6 +244,9 @@ class GatherRunner {
log.verbose('statusEnd', status);
});

// Disable throttling so the afterPass analysis isn't throttled
pass = pass.then(_ => driver.setThrottling(options.flags, {useThrottling: false}));
Copy link
Member

Choose a reason for hiding this comment

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

can you update the top outline to mention this as well? endTrace (if requested) & endNetworkCollect & endThrottling or something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@brendankenny
Copy link
Member

any reason appveyor keeps failing?

@paulirish
Copy link
Member

image

@patrickhulce
Copy link
Collaborator Author

patrickhulce commented Mar 28, 2017

@brendankenny yes everything should be failing that grabs canary chrome, hence #1911

@brendankenny
Copy link
Member

oh right, whoops, was thinking of the one that landed in 1.6.0

@brendankenny brendankenny merged commit 476e780 into master Mar 28, 2017
@brendankenny brendankenny deleted the disable_after_pass_throttling branch March 28, 2017 00:40
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

5 participants