Skip to content

Conversation

@robertbrignull
Copy link
Contributor

Changes getThreadsFlag to default to using all available cores instead of just 1. This makes the behaviour match getMemoryFlag which uses all available memory.

I've tried testing this by analyzing git, as an example of a medium-sized repository. These are the times for the "Perform CodeQL Analysis" step, so it excludes stuff like downloading and unpacking the action. I tried on a github.com cloud worker which have 2 cores and 7GB memory, and with a self-hosted runner with 8 cores and 64GB memory.

  • main branch, cloud worker = 8m 16s
  • main branch, self hosted worker = 6m 57s
  • max_threads branch, cloud worker = 8m 45s (I hope this slight increase is just a fluke)
  • max_threads branch, self hosted worker = 2m 24s

It's worth noting this PR is still only applying the number of threads to analysis. The other place we might get reasonable improvements is to extraction of scanned languages (i.e. javascript / python / go). I think we can do that separately though and get the various language teams involved to make sure we're doing the right thing.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.

src/util.ts Outdated
if (Number.isNaN(numThreads)) {
throw new Error(`Invalid threads setting "${numThreadsString}", specified.`);
}
const maxThreads = os.cpus().length;
Copy link
Contributor

Choose a reason for hiding this comment

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

You could just move this outside the if statement since it's needed in both branches.

@rneatherway rneatherway removed their assignment Aug 17, 2020
@rneatherway
Copy link
Contributor

LGTM

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.

4 participants