Pyhon 2.x or 3.x, which is faster?

Terry Reedy tjreedy at udel.edu
Sun Mar 6 07:17:33 EST 2016


On 3/6/2016 6:34 AM, Tony van der Hoff wrote:
> Hi, I've been experimenting with a short test program under python 2.7
> and python 3.4.2. It's a simple read from file, and locate a word therein.
>
> I get the (subjective) impression that python2  is slightly faster than
> python3. Is that correct? Is there any documentation to support this?

The relative speed depends on the particular operation, the compiler and 
OS, and the particular 3.x.y version.  Since 3.3.0, string (unicode) 
operations have been sped up, sometimes by a lot.  If you are looking 
for string speed, get 3.4.4 or 3.5.1.

-- 
Terry Jan Reedy




More information about the Python-list mailing list