Re: [hybi] WS ABNF

Dave Cridland <dave@cridland.net> Wed, 17 February 2010 17:17 UTC

Return-Path: <dave@cridland.net>
X-Original-To: hybi@core3.amsl.com
Delivered-To: hybi@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id AC8953A71BD for <hybi@core3.amsl.com>; Wed, 17 Feb 2010 09:17:21 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[AWL=0.000, BAYES_00=-2.599]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9SCBgwTZ1xfC for <hybi@core3.amsl.com>; Wed, 17 Feb 2010 09:17:19 -0800 (PST)
Received: from peirce.dave.cridland.net (peirce.dave.cridland.net [217.155.137.61]) by core3.amsl.com (Postfix) with ESMTP id 56F9828C102 for <hybi@ietf.org>; Wed, 17 Feb 2010 09:17:19 -0800 (PST)
Received: from localhost (localhost.localdomain [127.0.0.1]) by peirce.dave.cridland.net (Postfix) with ESMTP id 7C1E711680C2; Wed, 17 Feb 2010 17:18:56 +0000 (GMT)
X-Virus-Scanned: Debian amavisd-new at peirce.dave.cridland.net
Received: from peirce.dave.cridland.net ([127.0.0.1]) by localhost (peirce.dave.cridland.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BjfrIyarhmeZ; Wed, 17 Feb 2010 17:18:56 +0000 (GMT)
Received: from puncture (puncture.local [IPv6:2001:838:378:0:221:85ff:fe3f:1696]) by peirce.dave.cridland.net (Postfix) with ESMTPA id 2EAA211680C1; Wed, 17 Feb 2010 17:18:56 +0000 (GMT)
References: <8B0A9FCBB9832F43971E38010638454F032E566DDF@SISPE7MB1.commscope.com> <18559.1266310165.853559@puncture> <4B7A5FD1.8090005@gmx.de> <18559.1266313683.441640@puncture> <20100217025338.GA1654@shareable.org> <14781.1266401848.423659@puncture> <4B7C216E.7040404@caucho.com>
In-Reply-To: <4B7C216E.7040404@caucho.com>
MIME-Version: 1.0
Message-Id: <14781.1266427136.173597@puncture>
Date: Wed, 17 Feb 2010 17:18:56 +0000
From: Dave Cridland <dave@cridland.net>
To: Scott Ferguson <ferg@caucho.com>, Jamie Lokier <jamie@shareable.org>, Julian Reschke <julian.reschke@gmx.de>, Server-Initiated HTTP <hybi@ietf.org>
Content-Type: text/plain; delsp="yes"; charset="iso-8859-1"; format="flowed"
Content-Transfer-Encoding: 8bit
Subject: Re: [hybi] WS ABNF
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Server-Initiated HTTP <hybi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/hybi>
List-Post: <mailto:hybi@ietf.org>
List-Help: <mailto:hybi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hybi>, <mailto:hybi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 17 Feb 2010 17:17:21 -0000

On Wed Feb 17 17:03:42 2010, Scott Ferguson wrote:
> Dave Cridland wrote:
>>> Maybe for generality (no fixed limit), but it might have been an
>>> attempt to use fewer bytes for small messages.  Considering most
>>> messages are expected to be small(*), that's not entirely  
>>> illogical.
>> 
>> Not on the face of it, no. A naïve look would see that a whole 1-3  
>> octets are shaved off the wire, and that can't be a bad thing in  
>> and of itself.
>> 
>> The trouble is that it's vanishingly rarely saving any TCP  
>> packets, which would be interesting and useful, and nor is it  
>> saving any messages, which is essentially beyond the scope of the  
>> protocol. Those two *do* save appreciable amounts of bandwidth.
> This isn't complicated. 

Yes, yes it is. It's hugely more complex than it has any right or  
reason to be.

>  Just use a chunk/fragment encoding that looks like
> 
>  len ::= [\x80-\xff]{0,3}[\x00-\x7f]
> 
> The 0-terminating chunk takes up a single byte, small messages (<  
> 128) only need two bytes of overhead, chunk lengths are limited to  
> 32-bits (actually 28-bits but it doesn't matter), the total message  
> size is arbitrarily large, and it's trivial to implement.
> 
> 
Not even remotely as trivial as encoding it as a 32-bit network byte  
order integer. My point is that a compact representation is, here,  
simply not needed. In UTF-8, it *is* needed, because the potential  
savings are 75%, but here, the message itself is the bulk of the  
transfer, and there is no point in wasting effort in making length  
encoding harder than it needs to be to save a percentage point or two.

> If it's important to add message types (and that would be cleaner  
> as a different layer), that's just a single extra byte of overhead.

As I read it, there are already message types. I'm not wed to them  
being there, although I can see the utility of having message types  
and identifiers at a relatively low level. (It's useful both in BEEP  
and XMPP, for example).

Dave.
-- 
Dave Cridland - mailto:dave@cridland.net - xmpp:dwd@dave.cridland.net
  - acap://acap.dave.cridland.net/byowner/user/dwd/bookmarks/
  - http://dave.cridland.net/
Infotrope Polymer - ACAP, IMAP, ESMTP, and Lemonade