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 bugs in normalize_line(), and with a 2.7x speedup #2381

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kurtmckee
Copy link
Contributor

The following script was used for performance testing:

import timeit
import isort.parse

print(
    timeit.timeit(
        'isort.parse.normalize_line("from..cimport a")',
        number=5_000_000,
        globals={"isort": isort},
    )
)

Fastest time with code in main: 15.98 seconds
Fastest time with code in this PR: 5.82 seconds

These were identified but marked as `noqa`.
Now the duplicates are simply removed.
Copy link

codecov bot commented Mar 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.16%. Comparing base (3432318) to head (9aeaf27).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2381      +/-   ##
==========================================
- Coverage   99.16%   99.16%   -0.01%     
==========================================
  Files          40       40              
  Lines        3101     3100       -1     
  Branches      680      680              
==========================================
- Hits         3075     3074       -1     
  Misses         15       15              
  Partials       11       11              

@kurtmckee kurtmckee force-pushed the speedup-normalize-line branch from 916bc1c to 9aeaf27 Compare March 5, 2025 14:48
@kurtmckee
Copy link
Contributor Author

Thanks for the review, @DanielNoord! Is there anything preventing this PR (and the others you approved) from merging?

@DanielNoord
Copy link
Member

Mostly a review from @staticdev I think

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.

2 participants