Skip to content

optimize check_case_conflict.parents - #626

Merged
asottile merged 2 commits into
pre-commit:masterfrom
guykisel:case_conflict_performance
Jul 10, 2021
Merged

optimize check_case_conflict.parents#626
asottile merged 2 commits into
pre-commit:masterfrom
guykisel:case_conflict_performance

Conversation

@guykisel

@guykisel guykisel commented Jul 9, 2021

Copy link
Copy Markdown
Contributor

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.

@asottile asottile left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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

2 participants