I found a pypy Formula in homebrew so I tried it out:
brew install pypy
Installs Version 1.4.1, good enough. So let’s play with it.
As I want to install ipython, I need a virtualenv to install it without causing harm to my system.
Luckily virtualenv.py is easy to use, wait: http://www.virtualenv.org/en/latest/index.html#pypy-support “Currently only PyPy trunk is supported.”, hm.
Two changes to Formula needed in order to install trunk:
1. Install the latest nightly build as of today (1.5.0a). You might probably want to look up the latest version for yourself, md5 will not match that of course:
url 'http://buildbot.pypy.org/nightly/trunk/pypy-c-jit-42803-143c77a3550f-osx64.tar.bz2'
md5 '534d20d846d04b8003deebf1fdaea2cc'
2. Make sure to install “include” as I am pretty sure we will need it at some point:
prefix.install ["bin", "lib-python", "lib_pypy", "include"]
Result:
require 'formula'
require 'hardware'
class Pypy < Formula
url 'http://buildbot.pypy.org/nightly/trunk/pypy-c-jit-42803-143c77a3550f-osx64.tar.bz2'
md5 '534d20d846d04b8003deebf1fdaea2cc'
homepage 'http://pypy.org/'
version '1.5.0a'
def install
prefix.install ["bin", "lib-python", "lib_pypy", "include"]
end
end
After installing it I used it to run programs I wrote.
Long story short: As long as you don’t need packages like PIL or pycurl (tornado needs it), pypy works like a charm
It’s not as “fast” (according to pystone, depends on what you want to do…) as the other Pythons I have, but that always depends on your usecase of course:
Python 2.7.0 (143c77a3550f, Mar 20 2011, 03:00:09)
[PyPy 1.5.0-alpha0] on darwin
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``RPython: we use it so you don't
have to''
>>>> from test import pystone; pystone.main(10)
Pystone(1.1) time for 10 passes = 0.000379
This machine benchmarks at 26385.2 pystones/second
(1.4.1 get 26041.7 pystones/second).
What I usually use:
Python 2.7.1 (r271:86832, Jan 1 2011, 10:52:17)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from test import pystone; pystone.main(10)
Pystone(1.1) time for 10 passes = 0.000201
This machine benchmarks at 49751.2 pystones/second
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
>>> from test import pystone; pystone.main(10)
Pystone(1.1) time for 10 passes = 0.000148
This machine benchmarks at 67567.6 pystones/second
Comparing apples and oranges, enough for today. Thanks to the Pypy Team for their great work!