Re: [Cbor] Interactions of packed CBOR and tags

Brendan Moran <Brendan.Moran@arm.com> Fri, 04 September 2020 11:44 UTC

Return-Path: <Brendan.Moran@arm.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 A8F763A0E49 for <cbor@ietfa.amsl.com>; Fri, 4 Sep 2020 04:44:14 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.b=lce1ufoD; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.b=lce1ufoD
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 cIUipKy-r3dc for <cbor@ietfa.amsl.com>; Fri, 4 Sep 2020 04:44:13 -0700 (PDT)
Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150081.outbound.protection.outlook.com [40.107.15.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id BAABF3A0E43 for <cbor@ietf.org>; Fri, 4 Sep 2020 04:44:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qzz1Cf7cLFes5bGeKWN/gAT03VyQplk+b8EvTb9HUlU=; b=lce1ufoDJaVJL4xAmXgUzBHfs89PXkuIc2A83QpM5Jur4u2Wje/ZQQ986An8NnHTDasG3DDr5DOprEo/rTd0yakYxcTBx5NrZVdjnqGRSaqaF8cl/imdZpKZJ0mjzlbNEvcK6jElQwqVetyGoF71Wkd+Untm1NBeLRwtU6RWi7E=
Received: from AM4PR07CA0004.eurprd07.prod.outlook.com (2603:10a6:205:1::17) by DBAPR08MB5701.eurprd08.prod.outlook.com (2603:10a6:10:1a6::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.15; Fri, 4 Sep 2020 11:44:10 +0000
Received: from AM5EUR03FT063.eop-EUR03.prod.protection.outlook.com (2603:10a6:205:1:cafe::d9) by AM4PR07CA0004.outlook.office365.com (2603:10a6:205:1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.7 via Frontend Transport; Fri, 4 Sep 2020 11:44:10 +0000
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; ietf.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;ietf.org; dmarc=bestguesspass action=none header.from=arm.com;
Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com;
Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT063.mail.protection.outlook.com (10.152.16.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.16 via Frontend Transport; Fri, 4 Sep 2020 11:44:10 +0000
Received: ("Tessian outbound 7a6fb63c1e64:v64"); Fri, 04 Sep 2020 11:44:09 +0000
X-CheckRecipientChecked: true
X-CR-MTA-CID: e23c6f20bb717c37
X-CR-MTA-TID: 64aa7808
Received: from 6efef9997817.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 781B4E41-7483-4461-BA23-E0CF88B9D228.1; Fri, 04 Sep 2020 11:43:55 +0000
Received: from EUR03-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 6efef9997817.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 04 Sep 2020 11:43:55 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jXoDJC0oEDDVN93J7wSzAz57BHkEoWFp8HFOhvwFaNflnKtvWo1xhmcxME8mTUYSzxk2V27mijb8Chx604Z+LXbNUiS4f9NTfWd72n99+IyWvFwydbzckqZzBAjzqDOAyO051jY0Exwndr9zOXVnhOS7DFAbnZEy/3g2YePD4V5/dHsQijREcKlwsnkHGmsIOiGBc+7zdZpZckDdyak0DAaXrKUpFIOu6WPETzsn2laKbp4wh0axARx1NIocZv0ogG4yFZ7hiDprTTAjI2WVdxGRByFZ9pMRF18N1+yn0mAp/357ez3SSdOIF1NUe0wztd+jZ9QCG/A/xH9gDzkUzg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qzz1Cf7cLFes5bGeKWN/gAT03VyQplk+b8EvTb9HUlU=; b=IAMfsWmxfwwfnPKJv5B8bcB/ireCS5GC3yV0aytJFv+IR+14ydrt3Ror8jtfE36+c2gOApYqfBGdY7fx4z69ecB3dfxnxSq+Z5fPao2Dk+C1CcF30yCw5Gy1lotCJeKlJ0eSNnfxTcSLavvogRnwx2KGKGFmeG1S7wQS0SblEyRedkmq4jE0kY/4ZqjzItN1D81ej6yqzLs2Y2s7pWxsq7lWu7LZF3hwX1ZugG8B8rCkPQbnqnRn9Hz94flgXWr3z6DlbqNWH+je4mJGDDhRwdxSt4ty1Tg9nSNCl80yTh4v9jdMiURBh3BzC26AyVxw7tpuIja6+wphUrVfFFZn+Q==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qzz1Cf7cLFes5bGeKWN/gAT03VyQplk+b8EvTb9HUlU=; b=lce1ufoDJaVJL4xAmXgUzBHfs89PXkuIc2A83QpM5Jur4u2Wje/ZQQ986An8NnHTDasG3DDr5DOprEo/rTd0yakYxcTBx5NrZVdjnqGRSaqaF8cl/imdZpKZJ0mjzlbNEvcK6jElQwqVetyGoF71Wkd+Untm1NBeLRwtU6RWi7E=
Received: from AM6PR08MB4738.eurprd08.prod.outlook.com (2603:10a6:20b:cf::10) by AM6PR08MB3653.eurprd08.prod.outlook.com (2603:10a6:20b:4c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.16; Fri, 4 Sep 2020 11:43:54 +0000
Received: from AM6PR08MB4738.eurprd08.prod.outlook.com ([fe80::a98d:5ebe:dc1d:ea56]) by AM6PR08MB4738.eurprd08.prod.outlook.com ([fe80::a98d:5ebe:dc1d:ea56%3]) with mapi id 15.20.3348.017; Fri, 4 Sep 2020 11:43:54 +0000
From: Brendan Moran <Brendan.Moran@arm.com>
To: Carsten Bormann <cabo@tzi.org>
CC: Jim Schaad <ietf@augustcellars.com>, "cbor@ietf.org" <cbor@ietf.org>
Thread-Topic: [Cbor] Interactions of packed CBOR and tags
Thread-Index: AdZ8s0xpKERBvw7yTZyxz2a31flriAABj4uAAAP6fwABR/KiAAAIntwAAAHnt4AABjh9AAAhGpcA
Date: Fri, 4 Sep 2020 11:43:53 +0000
Message-ID: <8FBB9265-B721-4614-A397-F79C5DE9C3FF@arm.com>
References: <00c101d67cb5$2588b790$709a26b0$@augustcellars.com> <E30F54B6-1A63-48AC-89AE-61983654B5A9@tzi.org> <00cc01d67cc9$766c7b60$63457220$@augustcellars.com> <4AE9B2FA-EEB3-4B45-96E4-9DC85118567D@arm.com> <016f01d6820b$bc7d7cc0$35787640$@augustcellars.com> <25F7B7D3-7ED7-4062-8000-21D1AF1A69C3@arm.com> <89DE66A1-4490-4961-B8EA-EC07218B2A81@tzi.org>
In-Reply-To: <89DE66A1-4490-4961-B8EA-EC07218B2A81@tzi.org>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-mailer: Apple Mail (2.3608.120.23.2.1)
Authentication-Results-Original: tzi.org; dkim=none (message not signed) header.d=none;tzi.org; dmarc=none action=none header.from=arm.com;
x-originating-ip: [217.140.106.51]
x-ms-publictraffictype: Email
X-MS-Office365-Filtering-HT: Tenant
X-MS-Office365-Filtering-Correlation-Id: ef279ad8-764d-4e5a-fcf6-08d850c7d68c
x-ms-traffictypediagnostic: AM6PR08MB3653:|DBAPR08MB5701:
X-Microsoft-Antispam-PRVS: <DBAPR08MB5701D03DE4F1E64002D384F5EA2D0@DBAPR08MB5701.eurprd08.prod.outlook.com>
x-checkrecipientrouted: true
nodisclaimer: true
x-ms-oob-tlc-oobclassifiers: OLM:10000;OLM:10000;
X-MS-Exchange-SenderADCheck: 1
X-Microsoft-Antispam-Untrusted: BCL:0;
X-Microsoft-Antispam-Message-Info-Original: a6WgJAS+oBke3xFZtLEX+t4dSpuwrfSr4Uvv58YXez6C+iVKffIJBXWPd2neTCOzb7ntYy2W+diBqByvJCwMBVhN74dIq24lDlRTd5fFipTm6daiDGZRr1kf+1D0EiK6PupIw+cKtBWJKoE43QDNMly3dMxo6sQ/QOtNcHR5Aw4hnu5Z10MGmXU4NyrHE92uEtF84E7UCEdl+UBJ1YkxEO4No6FWN4N34H4hlEgdyiUXZFRIa3e6YX0Iuz2fXwJ0gTfi+2W/1rKLiOMjxes4Baz84U1QVEBHkf5uZEFhnnAd7/a85RTslKwFfuAHMpXj5DdTFHauAw9lElxMTXGYaQ==
X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB4738.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(136003)(396003)(346002)(366004)(39860400002)(6506007)(4326008)(53546011)(6916009)(83380400001)(86362001)(33656002)(478600001)(91956017)(2906002)(186003)(2616005)(66476007)(76116006)(66946007)(54906003)(66446008)(66556008)(64756008)(6486002)(6512007)(26005)(8936002)(8676002)(5660300002)(71200400001)(36756003)(316002); DIR:OUT; SFP:1101;
x-ms-exchange-antispam-messagedata: cuSyArY9SeSySHR8WYhXPEq+UmVZ+zYXfi2q2AiF6DvMYsiozY1vfSBsHQzELvJUqkh0hjxGZrsGYyUeo4h0ne2Iz2lrUm/47n3p26k3AUDL7vBwdfXtFVNAvzQlHARqbZOJERcSBiOmmfVvEx14P19DT2HoCqIBSk5pYvJGm3rJX8HiTw4H5Xdufq2epSZX9O9FcPpfsl+gQ52DuYbS4rZ/CCM64kYAPP0Wi1zSfMYrEMBfQ9pzOHvHOIspeJ4oTAxcONkvhNhEU2UmfoHU64BmS3YmYMVHK2AIyDXK3pqJ+EjoYojO20oCd7VTGB8d+4QG8M5qwHkWMf4801F6ggdHmLLA0QUMJL0cDvlrt63NxMmCLL3wJtDRUZHWb897/2Ogh2wBTcbNuqJf5CgNHwCTfhltpW4tnOHztHo/gnxYOqS+3uEQKakl1klXzVky3A2v+wTKAykqo3NEnLUrmNRE98N239YPF35OqMAZ9TVXYW7XTjM6h57To/IVHTkSiRp1s4XxO6RJozcHutmDOPrJGqL+6Yer8q94l2RdRtqxkE78MRDkX8IpFcQZTn1fp+o8vMrMC8bvd3SDFRuI6XHxaV6MfKQTlgJJgdeNP8vEytM5xKUNzTsgFinJg8aNvQ2NqWTqunWJI1RZlPbGOw==
x-ms-exchange-transport-forked: True
Content-Type: text/plain; charset="utf-8"
Content-ID: <1FAE6454C20D03449A03367826B27544@eurprd08.prod.outlook.com>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3653
Original-Authentication-Results: tzi.org; dkim=none (message not signed) header.d=none;tzi.org; dmarc=none action=none header.from=arm.com;
X-EOPAttributedMessage: 0
X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT063.eop-EUR03.prod.protection.outlook.com
X-MS-Office365-Filtering-Correlation-Id-Prvs: 8d83c325-de8b-4a28-3a42-08d850c7ccf6
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: TGCGgItpXNvqC9JSW3S+Awu5AJ6plla2cebHHl0uF52vYw+1JNLKBZ5Uijmm0J4WDkuMTJbqH9YXMwGM0Yh2oKe1a7mYRHxtXEcmqGa8x0d8IJKWkCsyzuRP9rDDljdzwVxQadsU/7Jp34y2aLYLu4xn7ty4zYppI0bwzqyEErABca7hB+zWNUz6+GoWvsWe5Mca1gGeEUoJxTcOgVrRd+Udi0TNoQNgVD1VGDs4h3obJRvSuaZFet1r3kmrebiIRfR5euv4IvsKlmHDHDf7dMmt5AEkiwCdlmuG92dMsfM9S507J8S9VOlHa6PwrZYuCSwJyeMe9f4o9q+UtWddyHiJO03D8ZDBci3DtuojyFJZm0bxqVLWMuYYsVAebJOfa61qTiCIIRafmVPdE7ct9A==
X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(39860400002)(136003)(396003)(376002)(346002)(46966005)(53546011)(6486002)(4326008)(356005)(83380400001)(5660300002)(316002)(36906005)(26005)(6506007)(81166007)(478600001)(8936002)(82740400003)(47076004)(2906002)(70586007)(6512007)(86362001)(82310400003)(186003)(8676002)(6862004)(33656002)(70206006)(2616005)(54906003)(36756003)(336012); DIR:OUT; SFP:1101;
X-OriginatorOrg: arm.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2020 11:44:10.0633 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: ef279ad8-764d-4e5a-fcf6-08d850c7d68c
X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com]
X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT063.eop-EUR03.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR08MB5701
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/rruaPKab2GiVW8VdVIfhb3Oi1nE>
Subject: Re: [Cbor] Interactions of packed CBOR and tags
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, 04 Sep 2020 11:44:15 -0000

> On 3 Sep 2020, at 20:55, Carsten Bormann <cabo@tzi.org> wrote:
>
> On 2020-09-03, at 18:57, Brendan Moran <Brendan.Moran@arm.com> wrote:
>>
>> However it’s still going to be bigger than a cbor-encoded plain text URIs if you have more than a few > 23 byte path segments, which is a bit annoying.
>
> It’s all in your head :-)
>
> The point of CBOR (which also was the point of JSON) was to be a reasonably appropriate encoding for much of what an application wants to do (the difference between JSON and CBOR is in what is “reasonably appropriate” in the areas of application).
>
> There is *always* a way to create a more compact bespoke encoding.  For anything.
> For URIs: We haven’t even started Huffman-coding the string parts.  (Or LZ-coding with some smart predefined dictionary.  Whatever.)  So why worry about the length indicator for > 23 byte path segments, where the text itself could be so much more efficiently coded?
>
> Engineers have a tendency to react to perceived optimization opportunities.  That is of course a good thing.  It turns bad when we start to tweak something and incur complexity costs just because it is slightly worse than something else.
> (If it is much worse in some metric, and that particular metric matters, well then back to the drawing board.  But not here.)
>
> Learning to use CBOR includes learning to tolerate the occasional bouts of cognitive dissonance that come from knowing “I could do this better” where the “better” is a few percent.

Normally, I’d agree with you. However, I did carefully consider the tradeoffs in this case. My argument is that there are two competing optimisations here:

1. Reduce parsing overhead for handling URIs by encoding them in CBOR
2. (Simply) Reduce encoding size of URIs.

I agree that scheme identification is better done by enum. I agree that domain name/IP is better identified with explicit text for domain name or bytes for IP. I agree that port number is better encoded as an integer.

I’m not yet convinced that there is a substantial reduction in complexity to be had by encoding a textual path as an array of CBOR text elements versus ‘/‘ delimited elements. I’ll have to go read through the mail archives on that one.

If it turns out that there is not a substantial reduction in complexity, then I don’t see why it would make sense to encode them in this way, rather than sticking with conventional URI path encoding.

Brendan
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.