Re: [Cbor] Review: draft-bormann-cbor-packed-00 & SUIT

Brendan Moran <Brendan.Moran@arm.com> Thu, 03 September 2020 10:22 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 F01EC3A0E47 for <cbor@ietfa.amsl.com>; Thu, 3 Sep 2020 03:22:39 -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=FqbMKh2z; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.b=FqbMKh2z
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 3ISrCvCM5HYj for <cbor@ietfa.amsl.com>; Thu, 3 Sep 2020 03:22:38 -0700 (PDT)
Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40081.outbound.protection.outlook.com [40.107.4.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 ADA633A0E3E for <cbor@ietf.org>; Thu, 3 Sep 2020 03:22:37 -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=nLToR6t6zUJJ2wmZbtei+Qk+ppgOAsFLnBMQoF/uHSY=; b=FqbMKh2zKYFEsx5a+ZBTSAq0joxtyx6+v8Q2BXuhkLlbz6AhRV2QNLlncapnT7+C7QToUnf3rwG11RpcrrabgNnSP9IblveQZ0g3HM68H29t3uKxSlTb/DHAJT/ADFwtWekWhFaIM2S90XHinUmVdu70u+qBhbcYMZQaq2uvy30=
Received: from AM5PR0101CA0032.eurprd01.prod.exchangelabs.com (2603:10a6:206:16::45) by AM6PR08MB4071.eurprd08.prod.outlook.com (2603:10a6:20b:a7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.23; Thu, 3 Sep 2020 10:22:35 +0000
Received: from VE1EUR03FT028.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:16:cafe::83) by AM5PR0101CA0032.outlook.office365.com (2603:10a6:206:16::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.15 via Frontend Transport; Thu, 3 Sep 2020 10:22:35 +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 VE1EUR03FT028.mail.protection.outlook.com (10.152.18.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Thu, 3 Sep 2020 10:22:34 +0000
Received: ("Tessian outbound 34b830c8a0ef:v64"); Thu, 03 Sep 2020 10:22:34 +0000
X-CheckRecipientChecked: true
X-CR-MTA-CID: c22171a1a39799bb
X-CR-MTA-TID: 64aa7808
Received: from a763db5361e9.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4D9A4257-B430-4036-A378-4D1A2FBC9D5C.1; Thu, 03 Sep 2020 10:22:28 +0000
Received: from EUR03-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a763db5361e9.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 03 Sep 2020 10:22:28 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WwLhZ7mVvdnyRT3TrCW2588gYUyVuFO1KmvvyXw9hLOzmZjSr8wFC2qSqyZpHVAaS6gAq6vmdh8ZT+rHKLS4x3lHaip1Rs+6nH9Hk8OVxjPRCWA0+z5KLpcJz3vFhrFgX1s+cSlZ0iVSxgELm3JoUqW+rppC7GxrCZO/RvZYzYzIKbb3MO+9Lu/LXEWRUyILqj3zx6TZs+O0oaJzMfkLL75kh+X2IJLT0qwDRf6t3n6HKYltxvy8mEGjFV0lTgu58mUIZdgPimGa7OrKXsR717fOtmJpB4Yu1QAFGmgRBO1oD/4Vqv06eL1pjCyLYFkXa0Ihece32+ZZ/LeK7COCnA==
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=nLToR6t6zUJJ2wmZbtei+Qk+ppgOAsFLnBMQoF/uHSY=; b=F3HHz4nf12oD40+IX7GUIyAdHporU7auCNgBwmsRnnX529xuhQsoDdEcYpzuCEXqTp0VjFycHjwReY4DH8gyPBoNJvMKlmMHFR1c4MZYN5UjSYot0BDSO3oeUAVSWrZRUWfICP5QWAK667d3DHy/BkiWsJhM3VAALOWx03DMUuHNi3VXo/s+1bmWy7iWclfhNh2ON8uFU3H5ewhFQWGZwBQCdiZzb068yWnJuySbOd7BHTcyJUNadIjA3fvs1JW19pqhoSnc1z3LdWgCnTl9A9iO+RlJ4DITVHZ8HOXDDktB+8Zfhd8JPF+Ltwzn7k073f8FaLMHtxf5OP/3yM+xtQ==
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=nLToR6t6zUJJ2wmZbtei+Qk+ppgOAsFLnBMQoF/uHSY=; b=FqbMKh2zKYFEsx5a+ZBTSAq0joxtyx6+v8Q2BXuhkLlbz6AhRV2QNLlncapnT7+C7QToUnf3rwG11RpcrrabgNnSP9IblveQZ0g3HM68H29t3uKxSlTb/DHAJT/ADFwtWekWhFaIM2S90XHinUmVdu70u+qBhbcYMZQaq2uvy30=
Received: from AM6PR08MB4738.eurprd08.prod.outlook.com (2603:10a6:20b:cf::10) by AM6PR08MB4660.eurprd08.prod.outlook.com (2603:10a6:20b:c1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.15; Thu, 3 Sep 2020 10:22:27 +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.016; Thu, 3 Sep 2020 10:22:27 +0000
From: Brendan Moran <Brendan.Moran@arm.com>
To: Michael Richardson <mcr+ietf@sandelman.ca>
CC: "cbor@ietf.org" <cbor@ietf.org>
Thread-Topic: [Cbor] Review: draft-bormann-cbor-packed-00 & SUIT
Thread-Index: AQHWZPM7PSkNaZ82xkeO03LjqC3Ah6kdPGyAgABBsICAACKngIAA30mAgABYagCAAFGhgIAJNsYAgC6NdAA=
Date: Thu, 03 Sep 2020 10:22:27 +0000
Message-ID: <C8842D1C-27EE-4E47-BFED-6BDF467C7038@arm.com>
References: <5E28C6E2-DFEC-4AF5-96CE-75E8F0927818@arm.com> <01d901d66503$2bbd93c0$8338bb40$@augustcellars.com> <7216D806-3473-463E-B6F2-AD8724AC56C6@tzi.org> <021e01d66535$57827d90$068778b0$@augustcellars.com> <406B6702-3045-4490-8CD0-8E352F924714@arm.com> <24543.1596045216@localhost> <AEB72DC9-76BF-49CB-BE70-7ABE2E4D9C39@arm.com> <15800.1596569288@localhost>
In-Reply-To: <15800.1596569288@localhost>
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: sandelman.ca; dkim=none (message not signed) header.d=none; sandelman.ca; dmarc=none action=none header.from=arm.com;
x-originating-ip: [217.140.106.49]
x-ms-publictraffictype: Email
X-MS-Office365-Filtering-HT: Tenant
X-MS-Office365-Filtering-Correlation-Id: 4d4e2366-8511-42d0-fcd9-08d84ff3464b
x-ms-traffictypediagnostic: AM6PR08MB4660:|AM6PR08MB4071:
X-Microsoft-Antispam-PRVS: <AM6PR08MB4071B6955CCCB628C7E1525EEA2C0@AM6PR08MB4071.eurprd08.prod.outlook.com>
x-checkrecipientrouted: true
nodisclaimer: true
x-ms-oob-tlc-oobclassifiers: OLM:7219;OLM:8882;
X-MS-Exchange-SenderADCheck: 1
X-Microsoft-Antispam-Untrusted: BCL:0;
X-Microsoft-Antispam-Message-Info-Original: 7NTN/hqbTRGVObt5+72Sb6KoYm+qfZaOb7piiEMybDfWEn4lxFuhkTe7SmXv5LVVYosSk4Ovi3UFaEUp+edhpAF6c3MmEYyjd0WQ9Hv/MU+wApm6fPPtuXT4LScj7JPhNr+7SLhcdX3vWB38+UY/dg/cqBPreLH0rt9GyitIOMiz1J1RiZaoqIMidJPopujatFTboisoDh7Xq8lWQC8IAISpQDOt18juIubMfKpJZZTF4IWY8lCJDIjy0U9cMbqp77eMKDaI4hz23IniI7x2tnfeU0WCYb3hrRihVoSa+0IMpfxDv2sbkvjZggYUUZ5ETgWtN8mh2TndIysJ9raCsw==
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)(396003)(366004)(39860400002)(346002)(376002)(136003)(4326008)(8936002)(2616005)(2906002)(86362001)(8676002)(26005)(478600001)(6512007)(83380400001)(33656002)(316002)(6506007)(6486002)(71200400001)(66476007)(64756008)(66556008)(66446008)(186003)(76116006)(91956017)(36756003)(5660300002)(53546011)(66946007); DIR:OUT; SFP:1101;
x-ms-exchange-antispam-messagedata: j6lPaOKot49nr41wF/5BPHfCIIpMiba/RkXbjEw0oJ76EwEcqTgV88tO8Z6hhDIo63Ca2Xs+e52h6WnHhuONl5jUyHbWY+jxdiKReP6HrqunEoH9n+w+3KC0MbL50NmcP0Og0dQCD7gVyI8S++y+AHcGogl/SsJK7dMDgqXFAQvo0y2fMK21XmpKB3qREpUlrTkI+74By3kOgNxMpzkUJmHeB8+fYyntNedN894z4CqdyTA5aS0Fal0SOlmIeu/ZgZImHG4gDifVwvt0LS5p/wewNBtVIgOwaBgsZsS9lax+c4uq2slB5uDKjg34BVeQ0Uk2yJuRM88uVbk3N42MYvu8VkN8Ie8kiFI7yZdmtPpcGeHn3sucxU0e9Nb+fxtiC3ngS6x5YjLxFMoIxljapnoE17bnaiOj2d67dyV9AE8K8FUM2opoMbQAIXcBX3YeInLutCovDBQ6UAGfumDwvfplsLlFawKnkidZrYh7nIaocitlHDADWtoOrbY8z+fk/jxc9RX6kIWgfHACSSiBxEbj6TYqCg3qTbZF9UoEXd+0nuL3O0t59TmztsEhXK6Fko/6NOtsePLs/uR6MkkBa3XVbDJvQxhXV7qb2inWrxaiCQMzNci7X8gdzRq/MYbU/w1rGKXv5KN9wPVxfTngWw==
x-ms-exchange-transport-forked: True
Content-Type: text/plain; charset="utf-8"
Content-ID: <6E245156EE818B46BF161F02B9B294F3@eurprd08.prod.outlook.com>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4660
Original-Authentication-Results: sandelman.ca; dkim=none (message not signed) header.d=none; sandelman.ca; dmarc=none action=none header.from=arm.com;
X-EOPAttributedMessage: 0
X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT028.eop-EUR03.prod.protection.outlook.com
X-MS-Office365-Filtering-Correlation-Id-Prvs: e8ef0786-1c64-482e-88b4-08d84ff34213
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: 7T9y6va0TeYYK0C/O9XnIp6P9ZGIXTZkMGWKfViP6yINCWSzfu/5VrlAlYmDarDFfFpZxEek0SvihZUq+FZZMRiK7XVJMW/ksVuAmgpmBERZSuCDjpAJ8tbGUzKtkVpfzBEB2GPnYDcgihivKS+OEKlxPT8rovuf8e00s83NmWqVPXJL7ZVMFGIFKBo7+eXLYl6yDMIz/dPsStq82RmfNH+n8al4ql9G6ZoLvyEPJK1D7QR4xNJB+G7KbK8JD5e8jYpIQBppw3YeLpxu35CtXibRm2GZ3Ve4+ZuASjcZoxaZKTl77LQazPpQPofy5cMuTXkqsUDBBdj4rXq+nL22iNxmt/jzIgqGHraa7lPqhR96wqFR3o3PZB6XOyofHgu2F8BiqMVtv+dPV83Oerto+w==
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)(346002)(376002)(39860400002)(136003)(396003)(46966005)(6862004)(26005)(6486002)(36906005)(86362001)(36756003)(53546011)(5660300002)(6506007)(70206006)(70586007)(356005)(4326008)(82310400003)(478600001)(6512007)(186003)(33656002)(2616005)(2906002)(83380400001)(336012)(8676002)(81166007)(8936002)(316002)(82740400003)(47076004); DIR:OUT; SFP:1101;
X-OriginatorOrg: arm.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2020 10:22:34.6837 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 4d4e2366-8511-42d0-fcd9-08d84ff3464b
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: VE1EUR03FT028.eop-EUR03.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4071
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/dkg8sUtGPrwyxX8qzlzfkzaNcEk>
Subject: Re: [Cbor] Review: draft-bormann-cbor-packed-00 & SUIT
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, 03 Sep 2020 10:22:40 -0000


> On 4 Aug 2020, at 20:28, Michael Richardson <mcr+ietf@sandelman.ca> wrote:
>
>
> Brendan Moran <Brendan.Moran@arm.com> wrote:
>>> Unless you mean that dictionaries should be sorted so that they always (can only)
>>> reference forward, and you can start at the current location in the current
>>> dictionary.
>
>> Possibly, but I’m not sure that’s universally advantageous. Remember
>> that we want high reference frequency items to be at the start. Suppose
>> that I have the prefixes [“https://“, “www.”, “files.”,
>> “domain.com”]. Clearly, I want to be able to compose these in one of
>> two ways:
>
> I agree that sorting by frequency of us has CPU advantages.
> I'm not sure that this is important enough ("premature optimization is the
> root of all evil").

Sorting by frequency of use only matters for the first handful of elements. This is not for CPU usage. It’s for size. Simple 0-15 are 1-byte references. Tag6(x) st. -24<x<24 are 2-byte references. -255 < x < 255 are 3-byte references.

I don’t care about sorting within the 1-byte references, 2-byte references, 3 byte references. If I have two values, one that appears 3 times and one that appears 300 times, I care that the 300-time reference is a 1-byte reference, not a 3-byte reference.

So sorting by frequency is important for compression.

> I think that I can put them together in any order in my CBOR, regardless of
> the order.  The ordering just restrictions how the internal reference in the
> dictionary can work, right?

Yes, I think that the draft should clearly define whether random access is permitted (loops possible) or forward references only (loops impossible).

If we care about compression, I would argue that random access is necessary, however that would cause additional complexity in loop detection.

> If you are saying that sometimes the compressor will be a constrained node,
> because CBOR is used outside of SUIT (who knew?), then I would like to
> retract my comment involving that five-letter word.

This comes back to the typical compression 3-way tradeoff: compression complexity vs. compression ratio vs. decompression complexity. Answering whether a constrained node will pack CBOR depends on the goal. Recognising the power consumption profiles of wireless sensor networks (e.g. LoRa) I think it’s reasonable to say that some lightweight compression is highly likely, since the active energy for transmit is very high compared to (almost any) microcontroller active energy. Then it becomes a memory complexity question. I think it’s unlikely that a wireless sensor node will try to compress a message that it can’t fit in memory. At least, not in LwM2M, CoAP, or MQTT, but maybe I’m missing something.

For wireless sensor nodes, I think the real question is code size for packing, not energy or memory. The really great thing about packed CBOR is that the document format is identical, regardless of how complex the encoder is. This will allow developers to tune packing algorithms for code size vs packing ratio vs memory vs. energy.

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.