[pypy-issue] [issue791] Simple wordcount is significantly slower and fatter than CPython

Justin Peel tracker at bugs.pypy.org
Sat Jul 16 07:41:12 CEST 2011

Justin Peel <peelpy at gmail.com> added the comment:

I don't know how much help this will be, but I decided to do a break down on 
various operations. These were done with a file containing only a million 
generated strings rather than ten million because I didn't want to wait forever. 
I did each test several times to make sure that the timings were consistent and 
took the median value. Timings were all done on a 32-bit Linux system with the 
pypy nightly build from July 14th, 2011. CPython version was 2.7.1.

just Counter on stdin-
cpython: 1.171s
pypy: 3.148s

Counter w/ print key, value-
cpython: 2.297s
pypy: 6.355s

Counter w/ print key[:-1], value-
cpython: 2.472s
pypy: 7.214s

iterating line by line over stdin-
cpython: 0.247s
pypy: 0.485s

iterating line by line over stdin and printing each line-
cpython: 0.708s
pypy: 2.596s

This indicates to me that we need to work on speeding up printing, the Counter 
object, and slicing strings (maybe this is a GC issue as well?). Iterating over 
stdin can use some work too, but those other ones are more worrisome to me.

nosy: +justinpeel

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list