Re: [hybi] frame length encoding

"Shelby Moore" <shelby@coolpage.com> Fri, 20 August 2010 19:20 UTC

Return-Path: <shelby@coolpage.com>
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 70F673A6782 for <hybi@core3.amsl.com>; Fri, 20 Aug 2010 12:20:12 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.028
X-Spam-Level:
X-Spam-Status: No, score=-2.028 tagged_above=-999 required=5 tests=[AWL=0.571, 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 uU5XyaQj8DPP for <hybi@core3.amsl.com>; Fri, 20 Aug 2010 12:20:11 -0700 (PDT)
Received: from www5.webmail.pair.com (www5.webmail.pair.com [66.39.3.83]) by core3.amsl.com (Postfix) with SMTP id 815D23A686D for <hybi@ietf.org>; Fri, 20 Aug 2010 12:20:11 -0700 (PDT)
Received: (qmail 23830 invoked by uid 65534); 20 Aug 2010 19:20:45 -0000
Received: from 121.97.54.174 ([121.97.54.174]) (SquirrelMail authenticated user shelby@coolpage.com) by sm.webmail.pair.com with HTTP; Fri, 20 Aug 2010 15:20:44 -0400
Message-ID: <26add474806860a5e365f3bfebb44d35.squirrel@sm.webmail.pair.com>
In-Reply-To: <AANLkTimKbmcpgx8k0uXUWvCO=8w9pPrtV=3y4qh6363k@mail.gmail.com>
References: <AANLkTimKbmcpgx8k0uXUWvCO=8w9pPrtV=3y4qh6363k@mail.gmail.com>
Date: Fri, 20 Aug 2010 15:20:44 -0400
From: Shelby Moore <shelby@coolpage.com>
To: John Tamplin <jat@google.com>
User-Agent: SquirrelMail/1.4.20
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
X-Priority: 3 (Normal)
Importance: Normal
Cc: Hybi <hybi@ietf.org>
Subject: Re: [hybi] frame length encoding
X-BeenThere: hybi@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: shelby@coolpage.com
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: Fri, 20 Aug 2010 19:20:12 -0000

> Option 2
> ========
> Use 7 bits in the frame header, and if the value is 0-125, that is the
> length.  If the value is 126, then the next 2 bytes are a 16-bit length.
> If
> the value is 127, the next 8 bytes are a 63-bit length (the high bit must
> be
> zero).
>
> long long len = readByte();
> switch (len) {
>   case 126:
>     len = readUnsignedShort();
>     break;
>   case 127:
>     len = readLongLong();
>     break;
> }

+1

Much superior than Option 1.

Reason is because with Option 1 overhead for small packets 127+ in size,
is significant (6% not including the rest of header).  And this Option 2,
only slightly increases the overhead for only one size value, 126.