Re: [Cbor] Ordering of items in the prefix table

Jim Schaad <ietf@augustcellars.com> Fri, 28 August 2020 21:46 UTC

Return-Path: <ietf@augustcellars.com>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D53193A0CB8; Fri, 28 Aug 2020 14:46:30 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W2AgImPWtk4X; Fri, 28 Aug 2020 14:46:28 -0700 (PDT)
Received: from mail2.augustcellars.com (augustcellars.com [50.45.239.150]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 1049B3A0CB0; Fri, 28 Aug 2020 14:46:27 -0700 (PDT)
Received: from Jude (73.180.8.170) by mail2.augustcellars.com (192.168.0.56) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 28 Aug 2020 14:46:16 -0700
From: Jim Schaad <ietf@augustcellars.com>
To: 'Carsten Bormann' <cabo@tzi.org>, 'Michael Richardson' <mcr+ietf@sandelman.ca>
CC: cbor@ietf.org, draft-bormann-cbor-packed@ietf.org
References: <008d01d67c48$d25c4440$7714ccc0$@augustcellars.com> <29638.1598639086@localhost> <B7320B50-BB7D-4E0C-BA11-E35B69F90867@tzi.org> <014101d67d80$6f9e4ea0$4edaebe0$@augustcellars.com>
In-Reply-To: <014101d67d80$6f9e4ea0$4edaebe0$@augustcellars.com>
Date: Fri, 28 Aug 2020 14:46:14 -0700
Message-ID: <014601d67d84$a92e57b0$fb8b0710$@augustcellars.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-Mailer: Microsoft Outlook 16.0
Content-Language: en-us
Thread-Index: AQFtMUzFC8cyVB3HBTXm03SCxCjA2QFt+GF3AuvedJUC3Z7Rrqnm6uGw
X-Originating-IP: [73.180.8.170]
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/Lsr75Aaa8RMMHREmlE9sxc3Z91s>
Subject: Re: [Cbor] Ordering of items in the prefix table
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 28 Aug 2020 21:46:31 -0000

It dawns on me that enforcing the order might be an IoT vs the Ocean choice.

Jim


-----Original Message-----
From: CBOR <cbor-bounces@ietf.org> On Behalf Of Jim Schaad
Sent: Friday, August 28, 2020 2:16 PM
To: 'Carsten Bormann' <cabo@tzi.org>; 'Michael Richardson' <mcr+ietf@sandelman.ca>
Cc: cbor@ietf.org; draft-bormann-cbor-packed@ietf.org
Subject: Re: [Cbor] Ordering of items in the prefix table



-----Original Message-----
From: Carsten Bormann <cabo@tzi.org>
Sent: Friday, August 28, 2020 11:30 AM
To: Michael Richardson <mcr+ietf@sandelman.ca>
Cc: Jim Schaad <ietf@augustcellars.com>; draft-bormann-cbor-packed@ietf.org; cbor@ietf.org
Subject: Re: [Cbor] Ordering of items in the prefix table

On 2020-08-28, at 20:24, Michael Richardson <mcr+ietf@sandelman.ca> wrote:
> 
> 
> Jim Schaad <ietf@augustcellars.com> wrote:
>> I was just going through an expansion algorithm and I started to 
>> wonder if we should have a requirement about order of items in the prefix table.
>> Specifically if an entry in the prefix table uses a prefix itself  (i.e.
>> entry 3 in the table is 6.2872("foo")), does that entry need to occur 
>> after the entry it references?
> 
> I also asked that question.
> If we don't enforce that rule, then the decoder has to take care of 
> dealing with loops.

Right.

> This means either having a maximum loop depth, or, using a mark to 
> refuse to expand any specific dictionary item more than once.
> I would prefer that all references are forward references.

(Backward references?)

This is easy with just one kind of table entry, but gets harder when prefixes can reference shared items which can reference other prefixes and so on.

[JLS] I think my mind just crashed.  For some reason I had made an assumption that items in the shared space are never tagged, but that does seem reasonable.  Of course until earlier today I never thought about the fact that a packed item could have an empty right value in the case that V1 is a prefix of V2.  Since I am just looking at getting the tables started,  I haven't looked hard yet at how I would encode this so it may not end up that way.
Jim



Of course, the tables could be merged, but that loses exactly one bit per reference that can be derived from the prefix vs. shared reference.

One other thing to keep in mind is that not all places in the table are equal — the compressor will likely sort the entries by frequency of use.  Requiring infrequent entries to occupy all the good positions does not lead to very compact encoding.


Grüße, Carsten


_______________________________________________
CBOR mailing list
CBOR@ietf.org
https://www.ietf.org/mailman/listinfo/cbor