Re: goless

Christian Tismer <[email protected]> Mon, 09 Jun 2014 17:22:17 +0200
Newsgroups gmane.comp.python.stackless
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============0133678986268603256==
Content-Type: multipart/alternative;
 boundary="------------080208010909020907000005"

This is a multi-part message in MIME format.
--------------080208010909020907000005
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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
>     <kristjan-hPzAiOG7rkJWk0Htik3J/[email protected] <mailto:kristjan-hPzAiOG7rkJWk0Htik3J/[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
>         <kristjan-hPzAiOG7rkJWk0Htik3J/[email protected] <mailto:kristjan-hPzAiOG7rkJWk0Htik3J/[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
>             <kristjan-hPzAiOG7rkJWk0Htik3J/[email protected] <mailto:kristjan-hPzAiOG7rkJWk0Htik3J/[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


--------------080208010909020907000005
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi,<br>
      <br>
      as I see it, the gevent implementation of PyPy does hard-switching
      via CFFI.<br>
      Is that true?<br>
      <br>
      A bit crazy, because<br>
      <br>
      - PyPy must work a lot to make hard-switched greenlets work<br>
      <br>
      - use those greenlets to make gevent work.<br>
      <br>
      This is a quite crazy waste, because PyPy has everything to build<br>
      a very lightweight and smooth goless without that overhead.<br>
      <br>
      The slightly under-developed stackless.py in PyPy performs so much
      better<br>
      because it is implemented on top of continulets, which are the
      basic building block.<br>
      <br>
      I think you would gain even better results by shortcutting the
      stackless.py<br>
      module and implement a Goless backend via continulets.<br>
      <br>
      cheers - Chris<br>
      <br>
      p.s.: This is out of the blue, and there might be cases where
      continulets are<br>
      not powerful enough to switch (and therefore need threads).<br>
      <br>
      <br>
      On 06.06.14 15:43, Rob Galanakis wrote:<br>
    </div>
    <blockquote
cite="mid:CABaNhwp6syjk_MpnhxvuezgqaNrzB3D78+kDgch-RFJO1eKJDA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org"
      type="cite">
      <div dir="ltr">OK, I did some proper benchmarking of CPython/PyPy
        and stackless/gevent combinations: <a moz-do-not-send="true"
          href="https://goless.readthedocs.org/en/latest/body.html#benchmarks">https://goless.readthedocs.org/en/latest/body.html#benchmarks</a>
        <div>
          And made the benchmarks easier to run and report.<br>
          <div><br>
          </div>
          <div>The common trend is:</div>
          <div>PyPy/stackless = x</div>
          <div>CPython/stackless = 2x-5x</div>
          <div>PyPy/gevent = 5-10x</div>
          <div>CPython/gevent = 15x-30x</div>
          <div><br>
          </div>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Tue, Jun 3, 2014 at 4:56 PM, Rob
          Galanakis <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:[email protected]" target="_blank">[email protected]</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">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'.</div>
            <div class="HOEnZb">
              <div class="h5">
                <div class="gmail_extra"><br>
                  <br>
                  <div class="gmail_quote">
                    On Tue, Jun 3, 2014 at 7:45 AM, Kristján Valur
                    Jónsson <span dir="ltr">&lt;<a
                        moz-do-not-send="true"
                        href="mailto:kristjan-hPzAiOG7rkJWk0Htik3J/[email protected]"
                        target="_blank">kristjan-hPzAiOG7rkJWk0Htik3J/[email protected]</a>&gt;</span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div link="blue" vlink="purple" lang="EN-US">
                        <div>
                          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">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.</span></p>
                          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Waiting
                              for your blog, I´m still a bit confused at
                              what you are doing.  did you implement
                              goless with a gevent backend?</span></p>
                          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">K</span></p>
                          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span></p>
                          <div style="border:none;border-left:solid blue
                            1.5pt;padding:0cm 0cm 0cm 4.0pt">
                            <div>
                              <div style="border:none;border-top:solid
                                #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
                                <p class="MsoNormal"><b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">From:</span></b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">
                                    <a moz-do-not-send="true"
                                      href="mailto:[email protected]"
                                      target="_blank">[email protected]</a>
                                    [mailto:<a moz-do-not-send="true"
                                      href="mailto:[email protected]"
                                      target="_blank">[email protected]</a>]
                                    <b>On Behalf Of </b>Rob Galanakis<br>
                                    <b>Sent:</b> 30. maí 2014 12:47</span></p>
                                <div>
                                  <div><br>
                                    <b>To:</b> The Stackless Python
                                    Mailing List<br>
                                    <b>Subject:</b> Re: [Stackless]
                                    goless</div>
                                </div>
                              </div>
                            </div>
                            <div>
                              <div>
                                <p class="MsoNormal"> </p>
                                <div>
                                  <p class="MsoNormal">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?</p>
                                  <div>
                                    <p class="MsoNormal">Anyway, it
                                      should be easy to profile
                                      eventually.</p>
                                    <div>
                                      <p class="MsoNormal"> </p>
                                      <div>
                                        <div>
                                          <p class="MsoNormal">Using
                                            backend StacklessBackend</p>
                                        </div>
                                        <div>
                                          <p class="MsoNormal">Benchmarking
                                            channels:</p>
                                        </div>
                                        <div>
                                          <p class="MsoNormal">  0.13s:
                                            Sync</p>
                                        </div>
                                        <div>
                                          <p class="MsoNormal">  0.14s:
                                            Async</p>
                                        </div>
                                        <div>
                                          <p class="MsoNormal">  0.13s:
                                            Buffered(1000)</p>
                                        </div>
                                        <div>
                                          <p class="MsoNormal">Benchmarking
                                            select:</p>
                                        </div>
                                        <div>
                                          <p class="MsoNormal">  0.29s:
                                            No default case.</p>
                                        </div>
                                        <div>
                                          <p class="MsoNormal">  0.15s:
                                            With default case.</p>
                                        </div>
                                        <div>
                                          <p class="MsoNormal"> </p>
                                        </div>
                                        <div>
                                          <p class="MsoNormal">Using
                                            backend GeventBackend</p>
                                        </div>
                                        <div>
                                          <p class="MsoNormal">Benchmarking
                                            channels:</p>
                                        </div>
                                        <div>
                                          <p class="MsoNormal">  0.87s:
                                            Sync</p>
                                        </div>
                                        <div>
                                          <p class="MsoNormal">  0.83s:
                                            Async</p>
                                        </div>
                                        <div>
                                          <p class="MsoNormal">  0.82s:
                                            Buffered(1000)</p>
                                        </div>
                                        <div>
                                          <p class="MsoNormal">Benchmarking
                                            select:</p>
                                        </div>
                                        <div>
                                          <p class="MsoNormal">  1.12s:
                                            No default case.</p>
                                        </div>
                                        <div>
                                          <p class="MsoNormal">  0.16s:
                                            With default case.</p>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                                <div>
                                  <p class="MsoNormal"
                                    style="margin-bottom:12.0pt"> </p>
                                  <div>
                                    <p class="MsoNormal">On Tue, May 27,
                                      2014 at 7:17 AM, Kristján Valur
                                      Jónsson &lt;<a
                                        moz-do-not-send="true"
                                        href="mailto:kristjan-hPzAiOG7rkJWk0Htik3J/[email protected]"
                                        target="_blank">kristjan-hPzAiOG7rkJWk0Htik3J/[email protected]</a>&gt;
                                      wrote:</p>
                                    <blockquote
                                      style="border:none;border-left:solid
                                      #cccccc 1.0pt;padding:0cm 0cm 0cm
6.0pt;margin-left:4.8pt;margin-right:0cm">
                                      <div>
                                        <div>
                                          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Well,
                                              I started doing some
                                              documentation using sphinx
                                              the other day but got
                                              sidetracked.</span></p>
                                          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">The
                                              current documentation
                                              lives in the modules and
                                              in the unittests.</span></p>
                                          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">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
                                              _<i>used</i>_ to only
                                              allow stackless.run() on
                                              the main tasklet.  The
                                              latest versions don’t.</span></p>
                                          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">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.</span></p>
                                          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">I
                                              need to put that little
                                              brick in there, and then
                                              everything will run
                                              smoothly
                                            </span><span
                                              style="font-size:11.0pt;font-family:Wingdings;color:#1f497d">J</span></p>
                                          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span></p>
                                          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">K</span></p>
                                          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span></p>
                                          <div
                                            style="border:none;border-left:solid
                                            blue 1.5pt;padding:0cm 0cm
                                            0cm 4.0pt">
                                            <div>
                                              <div
                                                style="border:none;border-top:solid
                                                #e1e1e1
                                                1.0pt;padding:3.0pt 0cm
                                                0cm 0cm">
                                                <p class="MsoNormal"><b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">From:</span></b><span
style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">
                                                    <a
                                                      moz-do-not-send="true"
href="mailto:[email protected]" target="_blank">[email protected]</a>
                                                    [mailto:<a
                                                      moz-do-not-send="true"
href="mailto:[email protected]" target="_blank">[email protected]</a>]
                                                    <b>On Behalf Of </b>Aleksandar
                                                    Radulovic<br>
                                                    <b>Sent:</b> 23. maí
                                                    2014 11:36</span></p>
                                                <div>
                                                  <div>
                                                    <p class="MsoNormal"><br>
                                                      <b>To:</b> The
                                                      Stackless Python
                                                      Mailing List<br>
                                                      <b>Subject:</b>
                                                      Re: [Stackless]
                                                      goless</p>
                                                  </div>
                                                </div>
                                              </div>
                                            </div>
                                            <div>
                                              <div>
                                                <p class="MsoNormal"> </p>
                                                <div>
                                                  <p class="MsoNormal">Speaking
                                                    of which, when can
                                                    we see some more
                                                    documentation or
                                                    examples on
                                                    stacklesslib? ;)</p>
                                                  <div>
                                                    <p class="MsoNormal"> </p>
                                                  </div>
                                                  <div>
                                                    <p class="MsoNormal">I
                                                      was fiddling with
                                                      it the other day
                                                      and couldn't find
                                                      any good enough
                                                      examples of
                                                      stacklesslib
                                                      usage..</p>
                                                  </div>
                                                  <div>
                                                    <p class="MsoNormal"> </p>
                                                  </div>
                                                  <div>
                                                    <p class="MsoNormal">Cheers,</p>
                                                  </div>
                                                  <div>
                                                    <p class="MsoNormal">alex</p>
                                                  </div>
                                                </div>
                                                <div>
                                                  <p class="MsoNormal"
                                                    style="margin-bottom:12.0pt"> </p>
                                                  <div>
                                                    <p class="MsoNormal">On
                                                      Tue, May 20, 2014
                                                      at 12:13 PM,
                                                      Kristján Valur
                                                      Jónsson &lt;<a
                                                        moz-do-not-send="true"
href="mailto:kristjan-hPzAiOG7rkJWk0Htik3J/[email protected]" target="_blank">kristjan-hPzAiOG7rkJWk0Htik3J/[email protected]</a>&gt;
                                                      wrote:</p>
                                                    <blockquote
                                                      style="border:none;border-left:solid
                                                      #cccccc
                                                      1.0pt;padding:0cm
                                                      0cm 0cm
6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
                                                      <div>
                                                        <div>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d">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</span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d">select, e.g.</span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d"> </span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d">c1 = stacklesslib.wait.WaitChannel()</span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d">c2 = stacklesslib.wait.WaitChannel()</span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d">…</span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d">for c in stacklesslib.wait.iwait([c1, c2]):</span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d">   if c is c1:  percolate()</span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d">   elif c is c2: promulgate()</span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d"> </span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d">A “WaitChannel” is ready when its balance is
                                                          non-zero.</span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d">There are also “Sendable” and “Receivable”
                                                          adapters for
                                                          WaitChannels
                                                          to in order to
                                                          wait for
                                                          either
                                                          positive or
                                                          negative
                                                          balance.</span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d"> </span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d">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.</span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d"> </span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d">K  </span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d"> </span></p>
                                                          <p
                                                          class="MsoNormal"><span
style="color:#1f497d"> </span></p>
                                                          <div
                                                          style="border:none;border-left:solid
                                                          blue
                                                          1.5pt;padding:0cm
                                                          0cm 0cm 4.0pt">
                                                          <div>
                                                          <div
                                                          style="border:none;border-top:solid
                                                          #e1e1e1
                                                          1.0pt;padding:3.0pt
                                                          0cm 0cm 0cm">
                                                          <p
                                                          class="MsoNormal"><b>From:</b>
                                                          <a
                                                          moz-do-not-send="true"
href="mailto:[email protected]" target="_blank">[email protected]</a>
                                                          [mailto:<a
                                                          moz-do-not-send="true"
href="mailto:[email protected]" target="_blank">[email protected]</a>]
                                                          <b>On Behalf
                                                          Of </b>Christian
                                                          Tismer<br>
                                                          <b>Sent:</b>
                                                          18. maí 2014
                                                          00:00<br>
                                                          <b>To:</b> The
                                                          Stackless
                                                          Python Mailing
                                                          List<br>
                                                          <b>Subject:</b>
                                                          Re:
                                                          [Stackless]
                                                          goless</p>
                                                          </div>
                                                          </div>
                                                          <div>
                                                          <div>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                          <div>
                                                          <p
                                                          class="MsoNormal">On
                                                          18.04.14
                                                          12:46,
                                                          Kristján Valur
                                                          Jónsson wrote:</p>
                                                          </div>
                                                          <blockquote
                                                          style="margin-top:5.0pt;margin-bottom:5.0pt">
                                                          <p
                                                          class="MsoNormal">Hi,
                                                          I though’t I’d
                                                          mention here
                                                          an
                                                          experimental
                                                          problem that a
                                                          few of my
                                                          colleagues
                                                          worked on
                                                          during PyCon:</p>
                                                          <p
                                                          class="MsoNormal">Goless!</p>
                                                          <p
                                                          class="MsoNormal"><a
moz-do-not-send="true"
                                                          href="http://goless.readthedocs.org/en/latest/index.html"
target="_blank">http://goless.readthedocs.org/en/latest/index.html</a></p>
                                                          <p
                                                          class="MsoNormal"> </p>
                                                          <p
                                                          class="MsoNormal">It
                                                          also shows how
                                                          more complex
                                                          behavior can
                                                          be built on
                                                          top of the
                                                          relatively
                                                          simple
                                                          primitives
                                                          that stackless
                                                          provides.</p>
                                                          </blockquote>
                                                          <p
                                                          class="MsoNormal"
style="margin-bottom:12.0pt"><br>
                                                          (a bit late,
                                                          but anyway
                                                          better than
                                                          never)<br>
                                                          <br>
                                                          Yes, quite
                                                          neat thing.<br>
                                                          This could be
                                                          used as an
                                                          interesting
                                                          example for
                                                          the Stackless
                                                          talk.<br>
                                                          <br>
                                                          cheers - Chris<br>
                                                          <br>
                                                          p.s.:
                                                          actually, I'm
                                                          studying Go a
                                                          bit, in order
                                                          to understand<br>
                                                          how they do
                                                          stuff, how
                                                          they lock, how
                                                          they schedule,
                                                          ...</p>
                                                          <pre>-- </pre>
                                                          <pre>Christian Tismer             :^)   <a moz-do-not-send="true" href="mailto:[email protected]" target="_blank">[email protected]</a></pre>
                                                          <pre>Software Consulting          :     <a moz-do-not-send="true" href="http://www.stackless.com/" target="_blank">http://www.stackless.com/</a></pre>
                                                          <pre>Karl-Liebknecht-Str. 121     :     <a moz-do-not-send="true" href="http://www.pydica.net/" target="_blank">http://www.pydica.net/</a></pre>
                                                          <pre>14482 Potsdam                :     GPG key -&gt; 0xFB7BEE0E</pre>
                                                          <pre>phone <a moz-do-not-send="true" href="tel:%2B49%20173%2024%2018%20776" target="_blank">+49 173 24 18 776</a>  fax <a moz-do-not-send="true" href="tel:%2B49%20%2830%29%20700143-0023" target="_blank">+49 (30) 700143-0023</a></pre>
                                                          </div>
                                                          </div>
                                                          </div>
                                                        </div>
                                                      </div>
                                                      <p
                                                        class="MsoNormal"><br>
_______________________________________________<br>
                                                        Stackless
                                                        mailing list<br>
                                                        <a
                                                          moz-do-not-send="true"
href="mailto:[email protected]" target="_blank">[email protected]</a><br>
                                                        <a
                                                          moz-do-not-send="true"
href="http://www.stackless.com/mailman/listinfo/stackless"
                                                          target="_blank">http://www.stackless.com/mailman/listinfo/stackless</a></p>
                                                    </blockquote>
                                                  </div>
                                                  <p class="MsoNormal"><br>
                                                    <br clear="all">
                                                  </p>
                                                  <div>
                                                    <p class="MsoNormal"> </p>
                                                  </div>
                                                  <p class="MsoNormal">--
                                                    <br>
                                                    a lex 13 x<br>
                                                    <a
                                                      moz-do-not-send="true"
href="http://a13x.net" target="_blank">http://a13x.net</a> | @a13xnet </p>
                                                </div>
                                              </div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                      <p class="MsoNormal"><br>
_______________________________________________<br>
                                        Stackless mailing list<br>
                                        <a moz-do-not-send="true"
                                          href="mailto:[email protected]"
                                          target="_blank">[email protected]</a><br>
                                        <a moz-do-not-send="true"
                                          href="http://www.stackless.com/mailman/listinfo/stackless"
                                          target="_blank">http://www.stackless.com/mailman/listinfo/stackless</a></p>
                                    </blockquote>
                                  </div>
                                  <p class="MsoNormal"> </p>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <br>
                      _______________________________________________<br>
                      Stackless mailing list<br>
                      <a moz-do-not-send="true"
                        href="mailto:[email protected]"
                        target="_blank">[email protected]</a><br>
                      <a moz-do-not-send="true"
                        href="http://www.stackless.com/mailman/listinfo/stackless"
                        target="_blank">http://www.stackless.com/mailman/listinfo/stackless</a><br>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Stackless mailing list
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="http://www.stackless.com/mailman/listinfo/stackless">http://www.stackless.com/mailman/listinfo/stackless</a></pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Christian Tismer             :^)   <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
Software Consulting          :     <a class="moz-txt-link-freetext" href="http://www.stackless.com/">http://www.stackless.com/</a>
Karl-Liebknecht-Str. 121     :     <a class="moz-txt-link-freetext" href="http://www.pydica.net/">http://www.pydica.net/</a>
14482 Potsdam                :     GPG key -&gt; 0xFB7BEE0E
phone +49 173 24 18 776  fax +49 (30) 700143-0023
</pre>
  </body>
</html>

--------------080208010909020907000005--


--===============0133678986268603256==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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