Re: [netmod] RFC7952 JSON streaming decoding efficiency?

Robert Varga <nite@hq.sk> Thu, 28 February 2019 09:46 UTC

Return-Path: <nite@hq.sk>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 04F7B130E79 for <netmod@ietfa.amsl.com>; Thu, 28 Feb 2019 01:46:46 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2
X-Spam-Level:
X-Spam-Status: No, score=-2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=hq.sk
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 TJMrKUiypucL for <netmod@ietfa.amsl.com>; Thu, 28 Feb 2019 01:46:44 -0800 (PST)
Received: from mail.hq.sk (hq.sk [81.89.59.181]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D52B9130E6B for <netmod@ietf.org>; Thu, 28 Feb 2019 01:46:43 -0800 (PST)
Received: from nitebug.nitenet.local (unknown [46.229.239.158]) by mail.hq.sk (Postfix) with ESMTPSA id 8C430241BD1; Thu, 28 Feb 2019 10:46:41 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hq.sk; s=mail; t=1551347201; bh=LrWS2X7jQOz5TyWrtYl73Kj84azD6ZOi186YsRFDL6M=; h=Subject:To:References:From:Date:In-Reply-To; b=R4UGGKbGZjj1xSLMmdQal3PysQI69wv2iSjlN6Vi9NSiQjTqBS6lmJICs8ahVkGPC KKJbEYmVLseqXo3L5XeE90TCYSFY5vFrCVzCJ2XTP3hLWHh1yCfojDc/tInaWlLZs8 5o26ppWJETU4BcUFUpQTkDU4Oy8kzRQKO1m4lrdU=
To: "Rob Wilton (rwilton)" <rwilton@cisco.com>, "netmod@ietf.org" <netmod@ietf.org>
References: <022ede1d-a195-21db-f0b6-0c299a935f42@hq.sk> <822cb25f1b894be9953a49ae12c91df9@XCH-RCD-007.cisco.com>
From: Robert Varga <nite@hq.sk>
Openpgp: preference=signencrypt
Message-ID: <e3c0f277-9706-3b20-f4ac-23d926e5cfe6@hq.sk>
Date: Thu, 28 Feb 2019 10:46:29 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1
MIME-Version: 1.0
In-Reply-To: <822cb25f1b894be9953a49ae12c91df9@XCH-RCD-007.cisco.com>
Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="UKpMMzpS5NEfoBbVR1RVPRl9YJjN8wXM0"
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/pegEitPjNJ3WaOq14nHEV1yRZbc>
Subject: Re: [netmod] RFC7952 JSON streaming decoding efficiency?
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 28 Feb 2019 09:46:46 -0000

On 28/02/2019 10:29, Rob Wilton (rwilton) wrote:
> Hi Robert,

Hey Rob,

> Isn't this just a limitation of JSON, in that the elements in an object are unordered (RFC 8259)?

Yes, but I believe this is object semantics leaking to on-wire format:
while a JSON object is inherently unordered, when emitting object to the
wire, implementations can choose to order the pairs to make
receiver-side processing more efficient.

I wonder if it would be of value to communicate such assumptions out of
band, like separate content-types. In case of RFC7952 the following
hints would be useful:
- the document does not contain metadata (i.e. plain RFC7951)
- "@" occurs as a first element in an object or not at all
- "@foo" occurs immediately after "foo" or not at all

This, of course, would be purely optional optimization...

Regards,
Robert