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

optimize check_case_conflict.parents #626

Merged
merged 2 commits into from
Jul 10, 2021

Conversation

guykisel
Copy link
Contributor

@guykisel guykisel commented Jul 9, 2021

fixes #625

performance for this approach on my team's repo:

λ py test.py
         10001077 function calls in 4.023 seconds

   Ordered by: standard name

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.039    0.039    4.023    4.023 <string>:1(<module>)
        4    0.000    0.000    0.000    0.000 _weakrefset.py:38(_remove)
        4    0.000    0.000    0.000    0.000 _weakrefset.py:81(add)
        3    0.000    0.000    0.289    0.096 check_case_conflict.py:13(lower_set)
        3    0.192    0.064    0.289    0.096 check_case_conflict.py:14(<setcomp>)
  3189661    1.037    0.000    2.010    0.000 check_case_conflict.py:17(parents)
        2    0.000    0.000    2.817    1.409 check_case_conflict.py:25(directories_for)
        2    0.807    0.404    2.817    1.409 check_case_conflict.py:26(<setcomp>)
        1    0.146    0.146    3.984    3.984 check_case_conflict.py:29(find_conflicting_filenames)
        2    0.000    0.000    0.000    0.000 subprocess.py:1023(_internal_poll)
        2    0.000    0.000    0.021    0.011 subprocess.py:1040(wait)
        2    0.000    0.000    0.608    0.304 subprocess.py:1067(_communicate)
       22    0.000    0.000    0.000    0.000 subprocess.py:179(Close)

So it's 4 seconds with this approach vs 20 seconds with the previous approach.

Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

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

@asottile asottile merged commit fe1db5f into pre-commit:master Jul 10, 2021
@guykisel guykisel deleted the case_conflict_performance branch July 10, 2021 19:45
@guykisel
Copy link
Contributor Author

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

check_case_conflict is slow in a repo with many files/directories on windows
2 participants