Hi,

as I see it, the gevent implementation of PyPy does hard-switching via CFFI.
Is that true?

A bit crazy, because

- PyPy must work a lot to make hard-switched greenlets work

- use those greenlets to make gevent work.

This is a quite crazy waste, because PyPy has everything to build
a very lightweight and smooth goless without that overhead.

The slightly under-developed stackless.py in PyPy performs so much better
because it is implemented on top of continulets, which are the basic
building block.

I think you would gain even better results by shortcutting the stackless.py
module and implement a Goless backend via continulets.

cheers - Chris

p.s.: This is out of the blue, and there might be cases where
continulets are
not powerful enough to switch (and therefore need threads).


On 06.06.14 15:43, Rob Galanakis wrote:
> OK, I did some proper benchmarking of CPython/PyPy and
> stackless/gevent
> combinations: https://goless.readthedocs.org/en/latest/body.html#benchmarks
>
> And made the benchmarks easier to run and report.
>
> The common trend is:
> PyPy/stackless = x
> CPython/stackless = 2x-5x
> PyPy/gevent = 5-10x
> CPython/gevent = 15x-30x
>
>
>
> On Tue, Jun 3, 2014 at 4:56 PM, Rob Galanakis <[email protected]
> <mailto:[email protected]>> wrote:
>
>     Yes there is a gevent backend. Has been from day one. You can
>     force one over the other by setting the GOLESS_BACKEND envvar to
>     'stackless' or 'gevent'.
>
>
>     On Tue, Jun 3, 2014 at 7:45 AM, Kristján Valur Jónsson
>     <[email protected] <mailto:[email protected]>> wrote:
>
>         I also think that gevent must be somehow sub-optimal.  I´ve
>         seen comparisons of python web frameworks where gevent based
>         backends don’t perform that well in terms of latency.
>
>         Waiting for your blog, I´m still a bit confused at what you
>         are doing.  did you implement goless with a gevent backend?
>
>         K
>
>          
>
>         *From:*[email protected]
>         <mailto:[email protected]>
>         [mailto:[email protected]
>         <mailto:[email protected]>] *On Behalf Of *Rob
>         Galanakis
>         *Sent:* 30. maí 2014 12:47
>
>
>         *To:* The Stackless Python Mailing List
>         *Subject:* Re: [Stackless] goless
>
>          
>
>         I was doing some benchmarking of goless under gevent and
>         stackless. The results are pretty astonishing when you do this
>         stuff in the interpreter! I will put it on GitHub later today
>         or tomorrow and also write up a blog. It's possible our
>         implementation is just not a good one regarding gevent, but I
>         sort of doubt it. The stackless/gevent specific code is
>         minimal (goless/backends.py) and I don't see anything ugly
>         that we're doing there. Maybe something is idiomatically very
>         different, or is gevent performance just not very good?
>
>         Anyway, it should be easy to profile eventually.
>
>          
>
>         Using backend StacklessBackend
>
>         Benchmarking channels:
>
>           0.13s: Sync
>
>           0.14s: Async
>
>           0.13s: Buffered(1000)
>
>         Benchmarking select:
>
>           0.29s: No default case.
>
>           0.15s: With default case.
>
>          
>
>         Using backend GeventBackend
>
>         Benchmarking channels:
>
>           0.87s: Sync
>
>           0.83s: Async
>
>           0.82s: Buffered(1000)
>
>         Benchmarking select:
>
>           1.12s: No default case.
>
>           0.16s: With default case.
>
>          
>
>         On Tue, May 27, 2014 at 7:17 AM, Kristján Valur Jónsson
>         <[email protected] <mailto:[email protected]>> wrote:
>
>             Well, I started doing some documentation using sphinx the
>             other day but got sidetracked.
>
>             The current documentation lives in the modules and in the
>             unittests.
>
>             I guess the only fiddly bit about it currently is to start
>             it up.  Currently one has to explicitly get the main loop
>             running.  This is because stackless _/used/_ to only allow
>             stackless.run() on the main tasklet.  The latest versions
>             don’t.
>
>             Once that restriction is removed, having the main loop run
>             implicitly much as the gevent library does (when the Hub
>             singleton is requested) is easy.
>
>             I need to put that little brick in there, and then
>             everything will run smoothly J
>
>              
>
>             K
>
>              
>
>             *From:*[email protected]
>             <mailto:[email protected]>
>             [mailto:[email protected]
>             <mailto:[email protected]>] *On Behalf Of
>             *Aleksandar Radulovic
>             *Sent:* 23. maí 2014 11:36
>
>
>             *To:* The Stackless Python Mailing List
>             *Subject:* Re: [Stackless] goless
>
>              
>
>             Speaking of which, when can we see some more documentation
>             or examples on stacklesslib? ;)
>
>              
>
>             I was fiddling with it the other day and couldn't find any
>             good enough examples of stacklesslib usage..
>
>              
>
>             Cheers,
>
>             alex
>
>              
>
>             On Tue, May 20, 2014 at 12:13 PM, Kristján Valur Jónsson
>             <[email protected] <mailto:[email protected]>> wrote:
>
>                 You may want to take a look at the latest version of
>                 “stacklesslib”, particularly the stacklesslib.wait
>                 module.  We now have “waitable” channels, so that you
>                 can do similar things to
>
>                 select, e.g.
>
>                  
>
>                 c1 = stacklesslib.wait.WaitChannel()
>
>                 c2 = stacklesslib.wait.WaitChannel()
>
>                 …
>
>                 for c in stacklesslib.wait.iwait([c1, c2]):
>
>                    if c is c1:  percolate()
>
>                    elif c is c2: promulgate()
>
>                  
>
>                 A “WaitChannel” is ready when its balance is non-zero.
>
>                 There are also “Sendable” and “Receivable” adapters
>                 for WaitChannels to in order to wait for either
>                 positive or negative balance.
>
>                  
>
>                 The stacklesslib.util.QueueChannel() is a channel with
>                 a fifo queue, which can be either unbounded (the
>                 default) or have a maximum length.  This is, I
>                 believe, similar to Go’s channels.
>
>                  
>
>                 K  
>
>                  
>
>                  
>
>                 *From:* [email protected]
>                 <mailto:[email protected]>
>                 [mailto:[email protected]
>                 <mailto:[email protected]>] *On Behalf
>                 Of *Christian Tismer
>                 *Sent:* 18. maí 2014 00:00
>                 *To:* The Stackless Python Mailing List
>                 *Subject:* Re: [Stackless] goless
>
>                  
>
>                 On 18.04.14 12:46, Kristján Valur Jónsson wrote:
>
>                     Hi, I though’t I’d mention here an experimental
>                     problem that a few of my colleagues worked on
>                     during PyCon:
>
>                     Goless!
>
>                     http://goless.readthedocs.org/en/latest/index.html
>
>                      
>
>                     It also shows how more complex behavior can be
>                     built on top of the relatively simple primitives
>                     that stackless provides.
>
>
>                 (a bit late, but anyway better than never)
>
>                 Yes, quite neat thing.
>                 This could be used as an interesting example for the
>                 Stackless talk.
>
>                 cheers - Chris
>
>                 p.s.: actually, I'm studying Go a bit, in order to
>                 understand
>                 how they do stuff, how they lock, how they schedule, ...
>
>                 -- 
>
>                 Christian Tismer             :^)   [email protected] 
> <mailto:[email protected]>
>
>                 Software Consulting          :     http://www.stackless.com/
>
>                 Karl-Liebknecht-Str. 121     :     http://www.pydica.net/
>
>                 14482 Potsdam                :     GPG key -> 0xFB7BEE0E
>
>                 phone +49 173 24 18 776 <tel:%2B49%20173%2024%2018%20776>  
> fax +49 (30) 700143-0023 <tel:%2B49%20%2830%29%20700143-0023>
>
>
>                 _______________________________________________
>                 Stackless mailing list
>                 [email protected] <mailto:[email protected]>
>                 http://www.stackless.com/mailman/listinfo/stackless
>
>
>
>              
>
>             -- 
>             a lex 13 x
>             http://a13x.net | @a13xnet
>
>
>             _______________________________________________
>             Stackless mailing list
>             [email protected] <mailto:[email protected]>
>             http://www.stackless.com/mailman/listinfo/stackless
>
>          
>
>
>         _______________________________________________
>         Stackless mailing list
>         [email protected] <mailto:[email protected]>
>         http://www.stackless.com/mailman/listinfo/stackless
>
>
>
>
>
> _______________________________________________
> Stackless mailing list
> [email protected]
> http://www.stackless.com/mailman/listinfo/stackless


-- 
Christian Tismer             :^)   [email protected]
Software Consulting          :     http://www.stackless.com/
Karl-Liebknecht-Str. 121     :     http://www.pydica.net/
14482 Potsdam                :     GPG key -> 0xFB7BEE0E
phone +49 173 24 18 776  fax +49 (30) 700143-0023

_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless

Reply via email to