Author vstinner
Recipients Oren Milman, mark.dickinson, serhiy.storchaka, vstinner, ztane
Date 2017-03-02.09:58:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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:55vstinnersetrecipients: + vstinner, mark.dickinson, serhiy.storchaka, ztane, Oren Milman
2017-03-02 09:58:55vstinnersetmessageid: <>
2017-03-02 09:58:55vstinnerlinkissue28272 messages
2017-03-02 09:58:54vstinnercreate