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

audit: make audit_revision_and_version_scheme faster. #7684

Merged
merged 1 commit into from
Jun 8, 2020

Conversation

MikeMcQuaid
Copy link
Member

This is really, really slow at the moment for a few reasons:

  • it goes through the list of revisions twice
  • it checks many more revisions than it needs to
  • it checks devel even when that's never used in homebrew/core

Even after these improvements it's still by far the slowest audit so am also making it a strict or new-formula audit.

before:

audit_postgresql:                   0.0000 sec
audit_gitlab_repository:            0.0000 sec
audit_bottle_spec:                  0.0000 sec
audit_github_repository:            0.0000 sec
audit_versioned_keg_only:           0.0000 sec
audit_style:                        0.0000 sec
audit_bottle_disabled:              0.0000 sec
audit_conflicts:                    0.0000 sec
audit_bitbucket_repository:         0.0000 sec
audit_homepage:                     0.0000 sec
audit_specs:                        0.0002 sec
audit_reverse_migration:            0.0004 sec
audit_prefix_has_contents:          0.0011 sec
audit_lines:                        0.0011 sec
audit_formula_name:                 0.0026 sec
audit_file:                         0.0068 sec
audit_deps:                         0.0125 sec
audit_text:                         0.0207 sec
audit_installed:                    0.1784 sec
audit_revision_and_version_scheme:  32.1020 sec

after:

audit_postgresql:                   0.0000 sec
audit_bottle_spec:                  0.0000 sec
audit_github_repository:            0.0000 sec
audit_versioned_keg_only:           0.0000 sec
audit_gitlab_repository:            0.0000 sec
audit_homepage:                     0.0000 sec
audit_bottle_disabled:              0.0000 sec
audit_conflicts:                    0.0000 sec
audit_style:                        0.0000 sec
audit_bitbucket_repository:         0.0000 sec
audit_specs:                        0.0002 sec
audit_reverse_migration:            0.0003 sec
audit_prefix_has_contents:          0.0010 sec
audit_lines:                        0.0011 sec
audit_formula_name:                 0.0029 sec
audit_deps:                         0.0038 sec
audit_file:                         0.0067 sec
audit_text:                         0.0227 sec
audit_installed:                    0.1935 sec
audit_revision_and_version_scheme:  12.6690 sec

I'm not confident this works as expected so would appreciate detailed review.

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew tests with your changes locally?

@MikeMcQuaid MikeMcQuaid force-pushed the faster_audit_revision_and_version_scheme branch from 1de4db6 to bc57e04 Compare June 3, 2020 16:41
Copy link
Member

@Bo98 Bo98 left a comment

Choose a reason for hiding this comment

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

I certainly understand what this code is doing much better than whatever it was doing before.

@MikeMcQuaid MikeMcQuaid force-pushed the faster_audit_revision_and_version_scheme branch 2 times, most recently from 7b3755d to be5999c Compare June 5, 2020 08:49
@MikeMcQuaid
Copy link
Member Author

@Bo98 Have added a --git (PR to add it to test-bot incoming). Let me know what you think. I'm aware some tests are failing.

@MikeMcQuaid MikeMcQuaid force-pushed the faster_audit_revision_and_version_scheme branch from be5999c to 0148157 Compare June 5, 2020 09:46
@Bo98
Copy link
Member

Bo98 commented Jun 5, 2020

Makes sense

This is really, really slow at the moment for a few reasons:
- it goes through the list of revisions twice
- it checks many more revisions than it needs to

Even after these improvements it's still by far the slowest audit so
am also making it a `--git` only audit.

Additionally, to further improve default `brew audit` performance do not
run `brew style` checks when doing `brew audit` with no arguments.

`brew style` can be run quickly and efficiently on all of a tap (and is
cached) so no need to duplicate it here.
@MikeMcQuaid MikeMcQuaid force-pushed the faster_audit_revision_and_version_scheme branch from 0148157 to 2a94d38 Compare June 8, 2020 14:00
@MikeMcQuaid MikeMcQuaid merged commit d07d220 into master Jun 8, 2020
@MikeMcQuaid MikeMcQuaid deleted the faster_audit_revision_and_version_scheme branch June 8, 2020 14:53
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Dec 28, 2020
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants