Message288789
issue28272_ver1.diff LGTM.
Mark Dickinson: "The extra check in maybe_small_long does have a value in (...) safety with respect to future maintenance,"
"assert(v != NULL);" has the same purpose. I think that it's ok to require that maybe_small_long() isn't call with NULL. The function is called 5 times and is never called with NULL. Note: long_normalize() cannot fail, it modifies the object in-place and returns the input object.
Mark Dickinson: "I'm a bit reluctant to make changes like this unless there's a measurable performance benefit."
I'm unable to see any impact on performance. Following microbenchmark is not significant:
---
haypo@smithers$ ./python -m perf timeit -s 'x=1' 'x<<1>>1<<1>>1<<1>>1<<1>>1<<1>>1<<1>>1<<1>>1<<1>>1' --duplicate=100 --compare-to ../master-ref/python --python-names=ref:patch
ref: ..................... 531 ns +- 10 ns
patch: ..................... 531 ns +- 2 ns
Median +- std dev: [ref] 531 ns +- 10 ns -> [patch] 531 ns +- 2 ns: 1.00x faster (-0%)
---
Note: python.exe -m perf timeit "122 >> 2" doesn't test long_rshirt() since "122 >> 2" is computed by the Python compiler, not at runtime ;-) |
|
Date |
User |
Action |
Args |
2017-03-02 09:58:55 | vstinner | set | recipients:
+ vstinner, mark.dickinson, serhiy.storchaka, ztane, Oren Milman |
2017-03-02 09:58:55 | vstinner | set | messageid: <1488448735.05.0.652052901055.issue28272@psf.upfronthosting.co.za> |
2017-03-02 09:58:55 | vstinner | link | issue28272 messages |
2017-03-02 09:58:54 | vstinner | create | |
|