[pypy-issue] [issue866] [PATCH] join is slow about 2x slower than Python

Justin Peel tracker at bugs.pypy.org
Mon Sep 12 08:12:00 CEST 2011


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

I attached another fastpath version which includes pulling the checks out of the 
final loop. Here are timings for the code in my initial posting:

CPython 2.7.1: 0.225 seconds

Pypy Sept 3 nightly: 0.441 seconds

Pypy w/ simplerpatch: 0.246 seconds

Pypy w/ strjoinbetter: 0.214 seconds

Pypy w/ strjoinbetter_v2: 0.204 seconds

I just did a bunch of manual timings and took what appeared to be the mode for 
each benchmark so these aren't very scientifically done. However, it should give 
you a good idea of the speed differences between the different versions.

If we actually don't want to do the fast path and want to focus on the 
multimethods, what needs to be done to remove the multimethods completely in 
pypy (it looks like a big job)? For instance, would str_w become basically a 
bunch of isinstance checks or what? 

What about the check if the object is w_str? space.isinstance checks are quite 
slow because they actually create a type object for the object and then search 
the mro of the type from what I remember. Is there a better way for 
space.isinstance to be implemented or to check if these objects are string 
derivative objects? CPython just uses a flag to check if the objects are strings 
if I remember correctly.

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue866>
________________________________________


More information about the pypy-issue mailing list