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

Alex Gaynor tracker at bugs.pypy.org
Wed Jul 13 09:27:25 CEST 2011

Alex Gaynor <alex.gaynor at gmail.com> added the comment:

So looking at just

c = Counter(sys.stdin)

2/3 of the time is spent in GC (60% of total in gc-minor) some of this is likely 
unavoidable, however there are two things we can do to improve the situation I 
think, one would be inlining into _file to avoid allocation W_StringObject 
(which just get unpacked because the dict is type specialized), and then there's 

p41 = new_with_vtable(ConstClass(W_IntObject))
((pypy.objspace.std.intobject.W_IntObject)p41).inst_intval = 1

in the loop, not sure what's up with that, as armin committed something that 
should turn objs with all constant fields into being preallocated.

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

More information about the pypy-issue mailing list