Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Gevent and PyPy
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 36 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
galfy  
View profile  
 More options Mar 19 2012, 5:18 am
From: galfy <galfyo.pun...@googlemail.com>
Date: Mon, 19 Mar 2012 02:18:00 -0700 (PDT)
Subject: Gevent and PyPy

With every new version PyPy is becoming faster. If you believe the
benchmarks [http://speed.pypy.org/] at the moment PyPy is 5x faster than
the CPython. That makes me "crave" for a combination pypy+gevent.
And this raises questions.
What is needed in order to be able to run gevent under PyPy?
Are there any efforts from third parties to make it possible?
Are there any workarounds, like CPyExt [
http://morepypy.blogspot.de/2010/04/using-cpython-extension-modules-w...]
that make this happen?

Regards,
 Gal


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Damien Churchill  
View profile  
 More options Mar 19 2012, 9:27 am
From: Damien Churchill <dam...@gmail.com>
Date: Mon, 19 Mar 2012 13:27:48 +0000
Local: Mon, Mar 19 2012 9:27 am
Subject: Re: [gevent] Gevent and PyPy
On 19 March 2012 09:18, galfy <galfyo.pun...@googlemail.com> wrote:

> What is needed in order to be able to run gevent under PyPy?

gevent would have to have support for running using PyPys stackless mode.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Floris Bruynooghe  
View profile  
 More options Mar 19 2012, 9:54 am
From: Floris Bruynooghe <f...@devork.be>
Date: Mon, 19 Mar 2012 13:54:51 +0000
Local: Mon, Mar 19 2012 9:54 am
Subject: Re: [gevent] Gevent and PyPy
On 19 March 2012 13:27, Damien Churchill <dam...@gmail.com> wrote:

> On 19 March 2012 09:18, galfy <galfyo.pun...@googlemail.com> wrote:
>> What is needed in order to be able to run gevent under PyPy?

> gevent would have to have support for running using PyPys stackless mode.

Actually pypy has it's own version of the greenlet module in their
default build afaik (built on slightly different primitives).  IIRC
Armin finished that not long after europython last year.  There'd
still be an amount of porting to be done though, since gevent includes
more C code then just greenlet, you might get started easier using
eventlet which has a few hubs to choose from, some of which only rely
on the stdlib.  On plain CPython that can be expected to be a little
slower but never tried PyPy myself.

Regards,
Floris

--
Debian GNU/Linux -- The Power of Freedom
www.debian.org | www.gnu.org | www.kernel.org


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hong Minhee  
View profile  
 More options Mar 19 2012, 5:29 pm
From: Hong Minhee <hong.min...@gmail.com>
Date: Mon, 19 Mar 2012 14:29:50 -0700 (PDT)
Local: Mon, Mar 19 2012 5:29 pm
Subject: Re: Gevent and PyPy

As Floris Bruynooghe mentioned, PyPy alread provide its own greenletmodule.  Another needed one is Cython.  To make gevent to run under PyPy,
Cython firstly has to be ported to PyPy or gevent has to use ctypes instead
of (or as a counterpart of) Cython.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Damien Churchill  
View profile  
 More options Mar 19 2012, 7:12 pm
From: Damien Churchill <dam...@gmail.com>
Date: Mon, 19 Mar 2012 23:12:24 +0000
Local: Mon, Mar 19 2012 7:12 pm
Subject: Re: [gevent] Re: Gevent and PyPy
On 19 March 2012 21:29, Hong Minhee <hong.min...@gmail.com> wrote:

> As Floris Bruynooghe mentioned, PyPy alread provide its own greenlet
> module.  Another needed one is Cython.  To make gevent to run under PyPy,
> Cython firstly has to be ported to PyPy or gevent has to use ctypes instead
> of (or as a counterpart of) Cython.

Or the cython modules are re-written in python using ctypes for use in PyPy.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vasile Ermicioi  
View profile  
 More options Mar 20 2012, 3:28 am
From: Vasile Ermicioi <elff...@gmail.com>
Date: Tue, 20 Mar 2012 09:28:26 +0200
Local: Tues, Mar 20 2012 3:28 am
Subject: Re: [gevent] Re: Gevent and PyPy

> at the moment PyPy is 5x faster than the CPython. That makes me "crave"
> for a combination pypy+gevent

I think greenlet module of pypy is not jit-able, that is, it may be slower
than with cpython

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Antonin AMAND  
View profile  
 More options Mar 21 2012, 3:48 am
From: Antonin AMAND <antonin.am...@gmail.com>
Date: Wed, 21 Mar 2012 08:48:56 +0100
Local: Wed, Mar 21 2012 3:48 am
Subject: Re: [gevent] Re: Gevent and PyPy
http://morepypy.blogspot.fr/2010/04/using-cpython-extension-modules-w...

It seems there is a Python C level API compatibility layer for pypy.
Since Cython produces traditional C extension code it would make it
possible to run the gevent C code produced by cython on pypy.

Or am I missing something ?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Antonin AMAND  
View profile  
 More options Mar 21 2012, 4:05 am
From: Antonin AMAND <antonin.am...@gmail.com>
Date: Wed, 21 Mar 2012 09:05:51 +0100
Local: Wed, Mar 21 2012 4:05 am
Subject: Re: [gevent] Re: Gevent and PyPy
Actually this article [1] discourage from running gevent on top of cpyext/pypy:

"cpyext is slow, and always will be slow. It has to emulate far too
many details of the CPython object model that don't exist on PyPy
(e.g., reference counting). Since people are using NumPy primarily for
speed this would mean that even if we could have a working NumPy, no
one would want to use it. Also, as soon as the execution crosses the
cpyext boundary, it becomes invisible to the JIT, which means the JIT
has to assume the worst and deoptimize stuff away."

[1] http://morepypy.blogspot.fr/2011/05/numpy-follow-up.html


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
André Cruz  
View profile  
 More options Apr 26 2012, 7:32 am
From: André Cruz <andre.c...@co.sapo.pt>
Date: Thu, 26 Apr 2012 04:32:53 -0700 (PDT)
Local: Thurs, Apr 26 2012 7:32 am
Subject: Re: [gevent] Re: Gevent and PyPy

So, there are no efforts in progress to make gevent usable under PyPy?

More importantly, is it expected that PyPy would provide a significant
performance boost?

Best regards,
André


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vasile Ermicioi  
View profile  
 More options Apr 26 2012, 12:01 pm
From: Vasile Ermicioi <elff...@gmail.com>
Date: Thu, 26 Apr 2012 19:01:56 +0300
Local: Thurs, Apr 26 2012 12:01 pm
Subject: Re: [gevent] Re: Gevent and PyPy

Armin Rigo is working on STM,
http://pypy.org/tmdonate.html


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
André Cruz  
View profile  
 More options Apr 26 2012, 12:07 pm
From: André Cruz <andre.c...@co.sapo.pt>
Date: Thu, 26 Apr 2012 17:07:50 +0100
Local: Thurs, Apr 26 2012 12:07 pm
Subject: Re: Re: [gevent] Gevent and PyPy

On Apr 26, 2012, at 17:01 , Vasile Ermicioi wrote:

> Armin Rigo is working on STM,
> http://pypy.org/tmdonate.html

And STM is needed for gevent support?

André


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Joiner  
View profile  
 More options Apr 26 2012, 12:12 pm
From: Matt Joiner <anacro...@gmail.com>
Date: Fri, 27 Apr 2012 00:12:06 +0800
Local: Thurs, Apr 26 2012 12:12 pm
Subject: Re: [gevent] Re: Gevent and PyPy

gevent attempts to work around concurrency problems in Python by reducing
the dependence on native threading. STM will likely reduce single threaded
performance, and by extension gevent.

There's also a good chance that C extensions won't work well, and that
PyPy's greenlet interface will be a low priority because of how it relates
to the goals of introducing STM.
On Apr 27, 2012 12:01 AM, "Vasile Ermicioi" <elff...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Randall Leeds  
View profile  
 More options Apr 26 2012, 2:46 pm
From: Randall Leeds <randall.le...@gmail.com>
Date: Thu, 26 Apr 2012 11:46:14 -0700
Local: Thurs, Apr 26 2012 2:46 pm
Subject: Re: [gevent] Re: Gevent and PyPy

On Thu, Apr 26, 2012 at 09:12, Matt Joiner <anacro...@gmail.com> wrote:
> gevent attempts to work around concurrency problems in Python by reducing
> the dependence on native threading. STM will likely reduce single threaded
> performance, and by extension gevent.

> There's also a good chance that C extensions won't work well, and that
> PyPy's greenlet interface will be a low priority because of how it relates
> to the goals of introducing STM.

I'm not sure I see that. There's been quite a lot of activity on the
pypy-dev list discussing ways to update PyPy's cpyext and bring some
things better in line with Cython and CPython. I can't say I've
followed it all super closely, but from my understanding making Cython
output compile with PyPy is the direction to go and the pypy-dev list
is where you want to go to talk about it.

A lot of the current discussion revolves around making C calls faster,
with fewer layers of indirection (the GC makes this difficult).
Unfortunately, calling C code from PyPy isn't brilliantly fast right
now, so it's not clear that gevent+pypy would be much better than a
pypy wsgi server without gevent.

At least... that's what I get from the discussions I'm seeing.

-Randall


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vasile Ermicioi  
View profile  
 More options Apr 26 2012, 3:03 pm
From: Vasile Ermicioi <elff...@gmail.com>
Date: Thu, 26 Apr 2012 22:03:47 +0300
Local: Thurs, Apr 26 2012 3:03 pm
Subject: Re: Re: [gevent] Gevent and PyPy

> And STM is needed for gevent support?

no, I gave the link because I think it responds to your other question ( is
it expected that PyPy would provide a significant performance boost )

"Notably, TM could benefit any event-based system that is written to
dispatch events serially (Twisted-based, most GUI toolkit, Stackless,
gevent, and so on). The events would internally be processed in parallel,
while maintaining the illusion of serial execution, with all the
corresponding benefits of safety. This should be possible with minimal
changes to the event dispatchers. This approach has been described by
the Automatic
Mutual Exclusion<http://research.microsoft.com/en-us/projects/ame/default.aspx>
work
at Microsoft Research, but not been implemented anywhere (to the best of
our knowledge)."


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Joiner  
View profile  
 More options Apr 27 2012, 1:09 am
From: Matt Joiner <anacro...@gmail.com>
Date: Fri, 27 Apr 2012 13:09:28 +0800
Local: Fri, Apr 27 2012 1:09 am
Subject: Re: Re: [gevent] Gevent and PyPy

Indeed that sounds quite handy.
On Apr 27, 2012 3:03 AM, "Vasile Ermicioi" <elff...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sean Talts  
View profile  
 More options May 9 2012, 12:24 pm
From: Sean Talts <xitr...@gmail.com>
Date: Wed, 9 May 2012 09:24:00 -0700 (PDT)
Subject: Re: Gevent and PyPy
It seems like we should be able to implement the gevent api in pure
python somewhat easily (since pypy already has greenlets and event
loops).  Has anyone done this?  Any reasons why it might be a bad
idea?

-Sean

On Apr 27, 1:09 am, Matt Joiner <anacro...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Floris Bruynooghe  
View profile  
 More options May 9 2012, 2:28 pm
From: Floris Bruynooghe <f...@devork.be>
Date: Wed, 9 May 2012 19:28:05 +0100
Local: Wed, May 9 2012 2:28 pm
Subject: Re: [gevent] Re: Gevent and PyPy
On 9 May 2012 17:24, Sean Talts <xitr...@gmail.com> wrote:

> It seems like we should be able to implement the gevent api in pure
> python somewhat easily (since pypy already has greenlets and event
> loops).  Has anyone done this?  Any reasons why it might be a bad
> idea?

This is essentially what eventlet does.  I had a quick experiment and
simple sockets seem to work with eventlet on pypy but urllib2 does
give a strange error.  Not sure I'll spend much time investigating
why, but it's interesting anyway.

Regards,
Floris

--
Debian GNU/Linux -- The Power of Freedom
www.debian.org | www.gnu.org | www.kernel.org


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Joiner  
View profile  
 More options May 9 2012, 2:56 pm
From: Matt Joiner <anacro...@gmail.com>
Date: Thu, 10 May 2012 02:56:15 +0800
Local: Wed, May 9 2012 2:56 pm
Subject: Re: [gevent] Re: Gevent and PyPy

I've done this. It's better in that the implementation is only several 100
lines. It's worse because the only reason it's useful is to work around
pathological contention in the GIL introduced by very high levels of
concurrency. Gevent reduces the concurrency overhead since most of it's
done in C.
On May 10, 2012 12:24 AM, "Sean Talts" <xitr...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sean Talts  
View profile  
 More options May 9 2012, 4:47 pm
From: Sean Talts <xitr...@gmail.com>
Date: Wed, 9 May 2012 13:47:48 -0700 (PDT)
Local: Wed, May 9 2012 4:47 pm
Subject: Re: [gevent] Re: Gevent and PyPy

I've never heard of this GIL issue with coroutines... What exactly happens?
 Do you know if this is still a problem in pypy?  Do you have the source
for your "pygevent" somewhere online I could fork?  Thanks!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Joiner  
View profile  
 More options May 9 2012, 8:29 pm
From: Matt Joiner <anacro...@gmail.com>
Date: Thu, 10 May 2012 08:29:44 +0800
Local: Wed, May 9 2012 8:29 pm
Subject: Re: [gevent] Re: Gevent and PyPy

Sorry, I explained poorly. What I'm saying is that scheduled coroutines
alleviate some negative aspects of the GIL. But doing the scheduling in
pure Python the overhead is very high anyway, you may as well use native
threading for the improved portability and compatibility with existing
code. Your mileage may vary of course.

Here's my Python 3, pure Python gevent clone:
https://bitbucket.org/anacrolix/gthread The README contains an overview of
my experiences with the model.

I also wrote an asynchronous framework using the new PEP 380 for Python
3.3: https://bitbucket.org/anacrolix/green380

Lastly, I wrote a pure Python script that monkey patches the stdlib and
allows you to run unmodified Python code emulating threads as greenlets,
which is my personal favorite: https://bitbucket.org/anacrolix/green380.
python3 goco.py <usual python parameters>.
On May 10, 2012 4:47 AM, "Sean Talts" <xitr...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Joiner  
View profile  
 More options May 12 2012, 5:05 am
From: Matt Joiner <anacro...@gmail.com>
Date: Sat, 12 May 2012 17:05:50 +0800
Local: Sat, May 12 2012 5:05 am
Subject: Re: [gevent] Re: Gevent and PyPy

Sorry the last link should have been
https://bitbucket.org/anacrolix/gocofor the pure Python framework.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
brett  
View profile  
 More options Jun 29 2012, 11:29 pm
From: brett <br...@insynchq.com>
Date: Fri, 29 Jun 2012 20:29:32 -0700 (PDT)
Local: Fri, Jun 29 2012 11:29 pm
Subject: Re: Gevent and PyPy

I have started on the gevent-ctypes port for PyPy.  I already removed the
cython stuff, and replaced libev with a ctypes wrapper for libev.
Greenlet + JIT support is coming later on in PyPy, currently the JIT will
not trace a greenlet, but at least it works.

You can get the source from here:
http://code.google.com/r/brett-gevent-ctypes/

-brett-


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adam Smith  
View profile  
 More options Aug 21 2012, 7:01 pm
From: Adam Smith <swiss.army.engin...@gmail.com>
Date: Tue, 21 Aug 2012 16:01:50 -0700 (PDT)
Local: Tues, Aug 21 2012 7:01 pm
Subject: Re: Gevent and PyPy

Can I revive this old thread to ask the status? Has pypy-1.9 (which
supports jit+greenlet) improved the situation any?

There's basically nothing in the python world I want more than to have
gevent-on-pypy for my worker daemons.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Benoit Chesneau  
View profile  
 More options Aug 22 2012, 3:42 am
From: Benoit Chesneau <bchesn...@gmail.com>
Date: Wed, 22 Aug 2012 09:42:34 +0200
Local: Wed, Aug 22 2012 3:42 am
Subject: Re: [gevent] Re: Gevent and PyPy
On Wed, Aug 22, 2012 at 1:01 AM, Adam Smith
<swiss.army.engin...@gmail.com> wrote:
> Can I revive this old thread to ask the status? Has pypy-1.9 (which supports
> jit+greenlet) improved the situation any?

> There's basically nothing in the python world I want more than to have
> gevent-on-pypy for my worker daemons.

I think it would be easier to port eventlet to pypy rather than gevent
since pypy offer a greenlet compatible API.

- benoît


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Saúl Ibarra Corretgé  
View profile  
 More options Aug 22 2012, 5:27 am
From: Saúl Ibarra Corretgé <sag...@gmail.com>
Date: Wed, 22 Aug 2012 11:27:14 +0200
Local: Wed, Aug 22 2012 5:27 am
Subject: Re: [gevent] Re: Gevent and PyPy
Hi,

Adam Smith wrote:
> Can I revive this old thread to ask the status? Has pypy-1.9 (which
> supports jit+greenlet) improved the situation any?

The PyPy guys seem to be going in the cffi direction, so I guess
gevent's core would need to be written with cffi instead of Cython.

Having that said, I don't know if there would be any performance
degradation when using CPython.

While it's not a simple task, but it can be done as a separated project:
lets say you have some cffi bindings for libev, you could create a
PyPyLoop class mirroring gevent.core.loop and then set it on
Hub.loop_class, so your core is used instead of the cython based one.
While not ideal, it may be a good start.

> There's basically nothing in the python world I want more than to have
> gevent-on-pypy for my worker daemons.

I'm really curious about this, are you finding any problems /
limitations? Personally I'd rather get Python 3 support than PyPy.

Regards,

--
Saúl Ibarra Corretgé
http://saghul.net/blog | http://about.me/saghul


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 36   Newer >
« Back to Discussions « Newer topic     Older topic »