PyPy Cape Town Sprint Oct 7th - Oct 21st 2012
Hello everyone!
The next PyPy sprint will be in Cape Town, South Africa. It is a public sprint, suitable for newcomers. It starts a couple of days after PyCon South Africa, which is on the 4th and 5th of October. This is a relatively unusual sprint in that it is hosted halfway across the world from where most contributors live, so we plan to spend some time during those two weeks doing sprinting and some time doing touristy stuff. The goals for the sprint are general progress and whatever people are interested in.
Possible topics:
- PyPy release 2.0
- running your software on PyPy
- work on PyPy's numpy (status)
- work on STM (status)
- JIT improvements
- any exciting stuff you can think of
If there are newcomers, we'll run the usual introduction to hacking on PyPy.
Location¶
The sprint will be held either in the apartment of fijal, which is in Tamboerskloof, Cape Town, or in the offices of the Praekelt Foundation, located in Woodstock, Cape Town. The Praekelt Foundation has offered to host us, if needed.
Cape Town, as a very touristy place, has tons of accomodation ranging in quality from good to amazing. Depending on the sprint location you might need a car.
Good to Know¶
You probably don't need visa for South Africa -- consult Wikipedia. South Africa is a lovely place with lots of stuff to do. You can see penguins, elephants, lions and sharks all on one day (or better yet, on multiple days).
There is a wide selection of good restaurants within a reasonable distance of the sprint venue (depending on the venue, either walking or driving).
The power plug is some weird derivative of an old-english standard, but adapters are easily acquired.
Who's Coming?¶
If you'd like to come, please let us know when you will be arriving and leaving, as well as what your interests are. We'll keep a list of people which we'll update (or you can do so yourself if you have bitbucket pypy commit rights).
Cheers,
fijal
Comments
Why pypy is three times slower than python2.6 + psyco2 ??
# text parser:
# python2.7 - 0.94s
# python2.7 + cython - 0.73s
# pypy1.9 - 0.68s
# python2.5 + psyco1.6 - 0.31s
# python2.6 + psyco2 - 0.23s
"python2.6 + psyco2" is 3.3 times faster than pypy1.9, why ??
Obviously if you don't provide a benchmark we're completely clueless.
I found that "cStringIO" is extremely slow in pypy1.9 (almost three times slower than python2.7), I'm using a lot of cStringIO in my text parser. here is my benchmark:
import time, cStringIO
def test1():
text = '1234567890' * 1024 * 256
sio = cStringIO.StringIO()
ts = time.time()
for ch in text: sio.write(ch)
print 'ts', time.time() - ts
try:
import psyco
psyco.full()
except:
pass
test1()
test1()
test1()
# python2.7 0.45s
# psyco2 0.26s
# pypy-1.9 1.30s
You could try using StringIO instead of cStringIO. pypy can optimize that much better.
Here’s an adapted example:
------ ------ ------
import time, StringIO, cStringIO
def csio():
text = '1234567890' * 1024 * 256
sio = cStringIO.StringIO()
ts = time.time()
for ch in text: sio.write(ch)
print 'ts', time.time() - ts
def nsio():
text = '1234567890' * 1024 * 256
sio = StringIO.StringIO()
ts = time.time()
for ch in text: sio.write(ch)
print 'ts', time.time() - ts
print "cStringIO"
csio()
csio()
csio()
print "StringIO"
nsio()
nsio()
nsio()
------ ------ ------
Results for me with pypy 1.9:
$ python stringiotest.py
cStringIO
ts 0.636300086975
ts 0.63633108139
ts 0.636710882187
StringIO
ts 3.35502791405
ts 3.34557986259
ts 3.33949017525
$ bin/pypy stringiotest.py
cStringIO
ts 1.05391597748
ts 0.528824090958
ts 0.530929803848
StringIO
ts 0.359623908997
ts 0.277186870575
ts 0.273662090302
thanks, it works with StringIO.
Increase the amount of iterations for even higher speedups:
text = '1234567890' * 1024 * 256 * 16
⇒
$ bin/pypy stringiotest.py
cStringIO
ts 224.367353201
ts 140.621050835
ts 140.672322035
StringIO
ts 5.80670285225
ts 4.95937395096
ts 4.82084798813
$ python stringiotest.py
cStringIO
ts 9.54650998116
ts 9.60773801804
ts 9.56916093826
StringIO
ts 47.1465728283
ts 47.145359993
ts 47.1618230343
Interestingly pypy with StringIO is twice as fast as python with cStringIO. But pypy with cStringIO is slow.
So pypy with StringIO might still require 2x as much time as python2.6+psyco2.
But remember that this compares pure python code on pypy with hand-optimized C-code+psyco.
Glad to help :)
The cool part here is that pypy allows us to replace many C-modules with nicely readable python-code and still get a fast program.
And that your custom code gets the same speedups.
in order to import StringIO as cStringIO. how to confirm my script is running pypy? not python ?
thanks for the post dear. nice blog.
you could just import sys:
import sys
ispypy = hasattr(sys, "pypy_version_info")