The Python Oracle

Times-two faster than bit-shift, for Python 3.x integers?

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 3

--

Chapters
00:00 Question
02:38 Accepted answer (Score 179)
06:33 Thank you

--

Full question
https://stackoverflow.com/questions/3705...

Question links:
[sorted_containers]: https://github.com/grantjenks/sorted_con...
[this line]: https://github.com/grantjenks/sorted_con...
[image]: https://i.stack.imgur.com/mrSuI.png
[image]: https://i.stack.imgur.com/Yo4wL.png
[image]: https://i.stack.imgur.com/2btSH.png
[image]: https://i.stack.imgur.com/ItTVG.png

Accepted answer links:
[the source code of Python's integer implementation]: https://hg.python.org/cpython/file/580dd...
[is defined as]: https://hg.python.org/cpython/file/580dd...
[integer multiplication implementation]: https://hg.python.org/cpython/file/580dd...
[MEDIUM_VALUE()]: https://hg.python.org/cpython/file/580dd...
[PyLong_FromLongLong()]: https://hg.python.org/cpython/file/580dd...
[long_lshift()]: https://hg.python.org/cpython/file/580dd...
[long_divrem()]: https://hg.python.org/cpython/file/580dd...
[a multiplication]: https://hg.python.org/cpython/file/580dd...
[is stored in a newly-allocated integer object]: https://hg.python.org/cpython/file/580dd...
[fast path]: https://github.com/python/cpython/blob/v...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #python3x #performance #bitshift #integerarithmetic

#avk47