Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #96923

Re: Lightwight socket IO wrapper

Path csiph.com!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; '21,': 0.07; 'bytes.': 0.07; 'cc:addr:python-list': 0.09; 'compact': 0.09; 'encoding.': 0.09; 'length.': 0.09; 'encoding': 0.15; 'buffering': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'simpson': 0.16; 'wrote:': 0.16; 'byte': 0.18; 'integer': 0.18; '>>>': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'sep': 0.22; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'chris': 0.26; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; 'socket,': 0.29; 'there.': 0.30; 'certainly': 0.30; 'another': 0.32; 'generally': 0.32; 'values.': 0.33; 'received:google.com': 0.35; 'question,': 0.35; 'problem.': 0.35; 'but': 0.36; 'too': 0.36; 'faster': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'anything': 0.38; 'mean': 0.38; 'sure': 0.39; "didn't": 0.39; 'some': 0.40; 'your': 0.60; 'cameron': 0.66; '128,': 0.84; 'chrisa': 0.84; 'absolutely': 0.88; 'to:none': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=PAHhVvjtmiIBXObuFW+g5d2n3mKeiAOLGWMGq4ntZWw=; b=uiaxCmTXlyaY+xi9XdJrzG1W83ymejVKg9V7Y4A9UGfIUWUCSv3GxEIstfo74O6mDz Kg7S3DbUJUkQeXCAy1VSZMaQ6+MpnOmEeTbU84lggp0UAd/1nQEv4X0vBwduhpwM8l3X bTSnUZAiaUa/6F23OLM0Z2nyPCHtVazeUcffyYZnTacUPO36uI8fKNndimrxkYkKDX4K WqHOMmF0CqUc2Eb68E40yoI2vkN8ThrAGunKw3aQQWJD8OQuTPLBbvriKUVHBgYYs/pu sr0rmZiPPhZz8s1UYCLe1qO3z50FYre+l+aFKwxkRPZ4bwTU5GpjjZpMVLoH+HUKmFiK DGFA==
MIME-Version 1.0
X-Received by 10.50.27.40 with SMTP id q8mr7653515igg.13.1442822843565; Mon, 21 Sep 2015 01:07:23 -0700 (PDT)
In-Reply-To <876134p5hw.fsf@elektro.pacujo.net>
References <CAPTjJmpuYp5uEDnRJqC9qKj-YkNRx1jW48WsRyRn+U0rzGiTYw@mail.gmail.com> <20150921062713.GA77399@cskk.homeip.net> <mailman.23.1442822248.28679.python-list@python.org> <876134p5hw.fsf@elektro.pacujo.net>
Date Mon, 21 Sep 2015 18:07:23 +1000
Subject Re: Lightwight socket IO wrapper
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.24.1442822846.28679.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1442822846 news.xs4all.nl 23770 [2001:888:2000:d::a6]:33257
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:96923

Show key headers only | View raw


On Mon, Sep 21, 2015 at 5:59 PM, Marko Rauhamaa <marko@pacujo.net> wrote:
> Chris Angelico <rosuav@gmail.com>:
>
>> On Mon, Sep 21, 2015 at 4:27 PM, Cameron Simpson <cs@zip.com.au> wrote:
>>> For sizes below 128, one byte of length. For sizes 128-16383, two bytes. And
>>> so on. Compact yet unbounded.
>>
>> [...]
>>
>> It's generally a lot faster to do a read(2) than a loop with any
>> number of read(1), and you get some kind of bound on your allocations.
>> Whether that's important to you or not is another question, but
>> certainly your chosen encoding is a good way of allowing arbitrary
>> integer values.
>
> You can read a full buffer even if you have a variable-length length
> encoding.

Not sure what you mean there. Unless you can absolutely guarantee that
you didn't read too much, or can absolutely guarantee that your
buffering function will be the ONLY way anything reads from the
socket, buffering is a problem.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Lightwight socket IO wrapper Chris Angelico <rosuav@gmail.com> - 2015-09-21 17:57 +1000
  Re: Lightwight socket IO wrapper Marko Rauhamaa <marko@pacujo.net> - 2015-09-21 10:59 +0300
    Re: Lightwight socket IO wrapper Chris Angelico <rosuav@gmail.com> - 2015-09-21 18:07 +1000
      Re: Lightwight socket IO wrapper Marko Rauhamaa <marko@pacujo.net> - 2015-09-21 11:38 +0300
        Re: Lightwight socket IO wrapper Chris Angelico <rosuav@gmail.com> - 2015-09-21 18:45 +1000
          Re: Lightwight socket IO wrapper Marko Rauhamaa <marko@pacujo.net> - 2015-09-21 11:48 +0300
            Re: Lightwight socket IO wrapper Marko Rauhamaa <marko@pacujo.net> - 2015-09-21 11:49 +0300
        Re: Lightwight socket IO wrapper Chris Angelico <rosuav@gmail.com> - 2015-09-21 18:50 +1000
          Re: Lightwight socket IO wrapper Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-09-22 07:59 +0000

csiph-web