[pypy-dev] PyPy doesn't make code written in C faster

Nathan Hurst njh at njhurst.com
Sat Jun 29 20:06:26 CEST 2013


On Sat, Jun 29, 2013 at 04:27:02PM +0200, Carl Friedrich Bolz wrote:
> On 29.06.2013 16:19, Nathan Hurst wrote:
> >On Wed, Jun 26, 2013 at 09:06:01AM +0200, Carl Friedrich Bolz wrote:
> >>On 30.05.2013 18:41, Nathan Hurst wrote:
> >>>It doesn't have to be quadratic, it's easy to come up with a splitting
> >>>algorithm:
> >>
> >>FWIW, I started turning this code into RPython code on the
> >>faster-str-of-bigint branch.


I don't actually see any difference between that code and normal
python.  What makes it rpython?


> >Do you have a github gist or similar?
> 
> I already merged it to the main branch:
> 
> https://bitbucket.org/pypy/pypy/commits/902241cca7dc4cb76bf65732c3d134543fb433a0
> 
> Thanks very much :-).
> 
> The main changes I did from your version was generalize it to work for
> any 3 <= n <= 36, optimize the handling of leading zeros and use a
> StringBuilder instead of a list to build the resulting string. Plus I
> kept the already existing fast version for powers of two alive.

All good decisions.  Is there a nice way to profile this with
something like line_profiler?  It's possible to improve the
asymptotics in various places, but they almost certainly aren't worth
it.

Of course the real question is whether pypy now beats python2.7 on the
all important factorial benchmark.  (And if so should we rush out a
new release? ;)

njh


More information about the pypy-dev mailing list