Message377794
> s there reason to believe that range.index is performed often enough that it's worth the extra code and maintenance cost here?
There are at least 3 reasons
1. pointer comparaition optimization quite common usecase in CPython codebase. e.x) list.count
2. if you create the range object, step = 1 which is singleton object is quite high percentage use case.
- range(100) -> step = 1
- range(-100, 100) -> step =1
- range(-100, 100, 2) -> step != 1
3. fast path code does not cost high difficulty maintainence for this case but can bring 12% performance enhancement. |
|
Date |
User |
Action |
Args |
2020-10-02 03:50:52 | corona10 | set | recipients:
+ corona10, mark.dickinson, vstinner, serhiy.storchaka, ammar2, pablogsal |
2020-10-02 03:50:52 | corona10 | set | messageid: <1601610652.05.0.593917881258.issue41902@roundup.psfhosted.org> |
2020-10-02 03:50:52 | corona10 | link | issue41902 messages |
2020-10-02 03:50:51 | corona10 | create | |
|