Commit 83782f6
committed
Use bisect instead of iterating over every offsets.
As the offsets looks already sorted (which looks logical so I assumed
they always are), using a bisection if faster than iterating over all
of them.
On a specific test I encontered, I got nice enhancement with this patch:
$ time python3 ./pycodestyle.py ~/Downloads/PmagPy/PmagPy/coefficients-552K.py > /dev/null
real 1m16.405s
$ time python3 ./pycodestyle.py ~/Downloads/PmagPy/PmagPy/coefficients-552K.py > /dev/null
real 0m3.318s1 parent 54a11aa commit 83782f6
1 file changed
+6
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| |||
1664 | 1665 | | |
1665 | 1666 | | |
1666 | 1667 | | |
1667 | | - | |
1668 | 1668 | | |
1669 | 1669 | | |
1670 | 1670 | | |
| 1671 | + | |
1671 | 1672 | | |
1672 | 1673 | | |
1673 | 1674 | | |
| |||
1681 | 1682 | | |
1682 | 1683 | | |
1683 | 1684 | | |
1684 | | - | |
1685 | | - | |
1686 | | - | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
1687 | 1689 | | |
1688 | 1690 | | |
1689 | 1691 | | |
| |||
0 commit comments