+ 2

Is python 3 faster than python 2?

python language

25th Jul 2017, 9:48 AM
Jakait Bill
Jakait Bill - avatar
3 Answers
+ 3
Certain methods are slower or faster in python 3 due to the difference in implementation compared with python 2, but overall from reading about the differences in various sources it seems like python 3 is actually slower overall.
25th Jul 2017, 10:17 AM
Maya
Maya - avatar
+ 2
which would you prefer?
25th Jul 2017, 10:30 AM
Jakait Bill
Jakait Bill - avatar
0
Yes, and no. It's faster in some areas, but the main reason for the performance impact is the implementation of the 'int' type. Python 3 is using something called arbitrary-sized integer type, where as in python 2 this is known as 'long'. Convenience for programmers (high levels of abstraction) makes our lives easier, the consequence for this was a performance impact. That being said, the change was also beneficial as well. If you use long integers, python 3.x is actually faster than python 2.x. As to the details in the background as to why that is - it's beyond my ability to explain that.
25th Jul 2017, 1:44 PM
Sapphire