Re: [Cbor] A CBOR tag for alternatives/unions, request for comments

Christian Amsüss <christian@amsuess.com> Thu, 24 February 2022 12:20 UTC

Return-Path: <christian@amsuess.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 844613A11F8 for <cbor@ietfa.amsl.com>; Thu, 24 Feb 2022 04:20:24 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.9
X-Spam-Level:
X-Spam-Status: No, score=-6.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-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 DEj2IQ2XKYFx for <cbor@ietfa.amsl.com>; Thu, 24 Feb 2022 04:20:22 -0800 (PST)
Received: from smtp.akis.at (smtp.akis.at [IPv6:2a02:b18:500:a515::f455]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D7DCC3A0C1A for <cbor@ietf.org>; Thu, 24 Feb 2022 04:20:21 -0800 (PST)
Received: from poseidon-mailhub.amsuess.com ([IPv6:2a02:b18:c13b:8010:a800:ff:fede:b1bd]) by smtp.akis.at (8.17.1/8.17.1) with ESMTPS id 21OCKGbd022990 (version=TLSv1.2 cipher=ECDHE-ECDSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Feb 2022 13:20:16 +0100 (CET) (envelope-from christian@amsuess.com)
X-Authentication-Warning: smtp.akis.at: Host [IPv6:2a02:b18:c13b:8010:a800:ff:fede:b1bd] claimed to be poseidon-mailhub.amsuess.com
Received: from poseidon-mailbox.amsuess.com (poseidon-mailbox.amsuess.com [IPv6:2a02:b18:c13b:8010:a800:ff:fede:b1bf]) by poseidon-mailhub.amsuess.com (Postfix) with ESMTP id B565AD0; Thu, 24 Feb 2022 13:20:14 +0100 (CET)
Received: from hephaistos.amsuess.com (unknown [IPv6:2a02:b18:c13b:8010:c452:7e07:77ef:2350]) by poseidon-mailbox.amsuess.com (Postfix) with ESMTPSA id 4D539FD; Thu, 24 Feb 2022 13:20:14 +0100 (CET)
Received: (nullmailer pid 1422327 invoked by uid 1000); Thu, 24 Feb 2022 12:20:13 -0000
Date: Thu, 24 Feb 2022 13:20:13 +0100
From: Christian Amsüss <christian@amsuess.com>
To: Carsten Bormann <cabo@tzi.org>
Cc: Michael Peyton Jones <michael.peyton-jones@iohk.io>, Duncan Coutts <duncan@well-typed.com>, cbor@ietf.org, Jared Corduan <jared.corduan@iohk.io>, Alexander Byaly <alexander.byaly@iohk.io>
Message-ID: <Yhd3/bwVUOLJLzWu@hephaistos.amsuess.com>
References: <CAKoRMYH3MTMi_tX5KHF-O-DTKzopiGqe3fi6XjkPaGCM4823OQ@mail.gmail.com> <7dfd62ccb6c089af90c90f26a8945f23232ecbc1.camel@well-typed.com> <CAKoRMYEOo1Gqfc4W4k3NOLKpFa97Q9YzLCm3r0PJ13V2HJPf3A@mail.gmail.com> <2BBF6463-FDB2-4A8A-B20D-7A1AD976A90D@tzi.org> <CAKoRMYFi8uo2GfHA9s1n+-rMO8Ja9=2qMMzjS9Z=F9r3LFozRQ@mail.gmail.com> <8EA89504-C176-4850-9BB8-C7E7206374FF@tzi.org> <CAKoRMYGmOa0hzEFsJh8kpz0bU5x56Yc9P=DBK-ghU83gXxPv7A@mail.gmail.com> <CAKoRMYGUvmxufQUVyvX2mciq5LCmV0Nz-uE2MJn54GDBB+9DRw@mail.gmail.com> <CAKoRMYF_19V6mu4S9GVqfiNzyQVvvOzX6eYwHp_DtZQoG0xTKg@mail.gmail.com> <4B47F4D7-ADE3-4A22-8A5B-97F4E5FCD933@tzi.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="+XGMCsOz7rNIe59m"
Content-Disposition: inline
In-Reply-To: <4B47F4D7-ADE3-4A22-8A5B-97F4E5FCD933@tzi.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/sQ1fkJu9L1jgDxQvxV3KIQEOmoI>
Subject: Re: [Cbor] A CBOR tag for alternatives/unions, request for comments
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: Thu, 24 Feb 2022 12:20:25 -0000

Hello Michael, Carsten,

putting my designated-expert hat on because this will sooner or later
reach me through the review that'll be asked for the 24-32767 range.

On Wed, Feb 23, 2022 at 02:16:14PM +0100, Carsten Bormann wrote:
> Current state of tag allocation:
> range  used     %                 free                total
> 0 1+0    12 50.00                   12                   24
> 1 1+1    62 26.72                  170                  232
> 2 1+2    45  0.07                65235                65280
> 3 1+4     3  0.00           4294901757           4294901760
> 4 1+8     2  0.00 18446744069414584318 18446744069414584320

this is asking 6 (in discussion with Michael, 8) out of the ~170
remaining short tags. Chunk allocations are not unheard of, and it's not
a particularly large chunk, but given that this is not a case coming
from the constrained or high-volume applications that CBOR was designed
for, I'd like to confirm:

Does it, for the applications expecting to use this, make a noticable
difference whether a 1+1 or a 1+2 tag is used?

(The difference is likely most pronounced on alternatives without actual
payload; expressing the two values of `Either () ()` (if I'm getting this
right; in Rust I might say `Result<(), ()>`) would take 4 byte each vs.
3 byte each for the full value including the tagged nil / empty-tuple).

If not, I'd suggest that, say, 128 tags could be requested from 1+2,
leaving the 1+1+1+(2..) version for the unbounded range.

If so, please provide some note about how this does make a difference,
which I can refer to when eventually reviewing the entry.

BR
c

-- 
To use raw power is to make yourself infinitely vulnerable to greater powers.
  -- Bene Gesserit axiom