Skip to content

Fix bugs in normalize_line(), and with a 2.7x speedup#2381

Closed
kurtmckee wants to merge 4 commits intoPyCQA:mainfrom
kurtmckee:speedup-normalize-line
Closed

Fix bugs in normalize_line(), and with a 2.7x speedup#2381
kurtmckee wants to merge 4 commits intoPyCQA:mainfrom
kurtmckee:speedup-normalize-line

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.
@codecov
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 (44c174a).
Report is 10 commits behind head on main.

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              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@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

@kurtmckee kurtmckee closed this May 12, 2025
@kurtmckee kurtmckee deleted the speedup-normalize-line branch May 12, 2025 13:10
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.

3 participants