Re: [jose] Performance of Canonical JSON

Bret Jordan <jordan.ietf@gmail.com> Fri, 07 December 2018 18:25 UTC

Return-Path: <jordan.ietf@gmail.com>
X-Original-To: jose@ietfa.amsl.com
Delivered-To: jose@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B7C36130F88 for <jose@ietfa.amsl.com>; Fri, 7 Dec 2018 10:25:29 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.998
X-Spam-Level:
X-Spam-Status: No, score=-1.998 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, MIME_QP_LONG_LINE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
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 cdEfnWLqRzEY for <jose@ietfa.amsl.com>; Fri, 7 Dec 2018 10:25:27 -0800 (PST)
Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) (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 56213130F7F for <jose@ietf.org>; Fri, 7 Dec 2018 10:25:27 -0800 (PST)
Received: by mail-pg1-x531.google.com with SMTP id d72so2064002pga.9 for <jose@ietf.org>; Fri, 07 Dec 2018 10:25:27 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=jIZ00//7nPhiCbks/rNIMnqGzI1HWYYE7ociCnngL9I=; b=NZkFs+DXbRmHIZGi+fIdWz5P4/MZmNG4D8ARlhLMZQNZpqKwBSx2t8KGOx+bmcm3qB 8jDLSmx46aSTh7hX3TYXaQbTWA3edUk7rjvhI83Nm5UEw2o2pgKSXi0PYgbgK4GaW5Dy RVRalem/J0CmdfNe8u0GXJAN3GUqlgvdRHmYWx1qKUHvzAwZj3Xp/aGXQFCrswimhImx mipH4sQiNJ3Hr2X+isSQSGF6QFIB1g6JP3C0bZq3eDqvorPlpGWi69xSQigfxhz5BQqe 8hP8fXSBGgv2wKuLThTN333ZJmODW79r1RhWoHs1T+pRlmu5oSXwK2jxyHotUzxtO2A1 GGOw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=jIZ00//7nPhiCbks/rNIMnqGzI1HWYYE7ociCnngL9I=; b=OJXAPVgZ4PBa1GDoSU3dPViFQLXTzTZK8SMM9M63gy0MeEPt/b49iIjImmLcHHVBbd vbU660D/tUYORx0v2PuBEHsG7GchiD+SC4EDN9XUqhLQzCFSn71vnpVxRqCc/tiFVs4R mttCkrv0BnY5LSTDeEFbkE2Phzvy5ckD1jUGXoCLQOwzaaTV9TJ2rlvAWS3uo+GrXacs OtEWuQv/dvmSK/NYvwi4StPEFbNtxiHm3Ndg3A5w0gxuOOkDtziINKGMO6RlNvMQ1zxM Y7+PJYxx5KDeKvS6XpWCvwOVZxOhZMIEKrQL+Dd1SWKuYqosw4i6xCt4/JLeMP2fDOop jjNw==
X-Gm-Message-State: AA+aEWZMsOkCDyv0jUi9r+mAAuV0FwHygcRZVuL4Q9rrgBUynGp61NAC xqvd/REe3PNhYD1FjqlUyd4vw3Gu
X-Google-Smtp-Source: AFSGD/W1QJ6OSg2dfU/t2wsdY/tUa+v4w7qmK/TJMhIyhmbT6zyZ8vAJ+55gmILihJBryXNViPKM6A==
X-Received: by 2002:a62:345:: with SMTP id 66mr3235674pfd.189.1544207126559; Fri, 07 Dec 2018 10:25:26 -0800 (PST)
Received: from ?IPv6:2600:100f:b004:e7f6:d060:41a7:88bc:5a6e? ([2600:100f:b004:e7f6:d060:41a7:88bc:5a6e]) by smtp.gmail.com with ESMTPSA id c7sm9661452pfa.24.2018.12.07.10.25.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 10:25:25 -0800 (PST)
Content-Type: multipart/alternative; boundary="Apple-Mail-DDC454ED-8420-4BB1-AFB7-9155FBA01C26"
Mime-Version: 1.0 (1.0)
From: Bret Jordan <jordan.ietf@gmail.com>
X-Mailer: iPhone Mail (16B92)
In-Reply-To: <3466a48c-115d-3810-4c94-0e213ba407fd@gmail.com>
Date: Fri, 07 Dec 2018 10:25:24 -0800
Cc: "jose@ietf.org" <jose@ietf.org>
Content-Transfer-Encoding: 7bit
Message-Id: <3386D76C-D8FA-43CA-9B4A-B171C6B61267@gmail.com>
References: <3466a48c-115d-3810-4c94-0e213ba407fd@gmail.com>
To: Anders Rundgren <anders.rundgren.net@gmail.com>
Archived-At: <https://mailarchive.ietf.org/arch/msg/jose/Vwwxr1iML_-JAR3rLLsFZ6QRmEY>
Subject: Re: [jose] Performance of Canonical JSON
X-BeenThere: jose@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Javascript Object Signing and Encryption <jose.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/jose>, <mailto:jose-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/jose/>
List-Post: <mailto:jose@ietf.org>
List-Help: <mailto:jose-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/jose>, <mailto:jose-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 07 Dec 2018 18:25:30 -0000

Thanks for the test data. Are you going to request a side meeting for Prague?

Bret 

Sent from my Commodore 128D

PGP Fingerprint: 63B4 FC53 680A 6B7D 1447  F2C0 74F8 ACAE 7415 0050

> On Dec 7, 2018, at 9:23 AM, Anders Rundgren <anders.rundgren.net@gmail.com> wrote:
> 
> Since XML Canonicalization has a reputation of not only being brittle but also terribly slow, I tested JCS [1] with the following JSON file:
> {
>   "1": {"f": {"f": "hi","F": 5} ,"\n": 56.0},
>   "10": { },
>   "": "empty",
>   "a": { },
>   "111": [ {"e": "yes","E": "no" } ],
>   "A": { }
> }
> 
> Expected output: {"":"empty","1":{"\n":56,"f":{"F":5,"f":"hi"}},"10":{},"111":[{"E":"no","e":"yes"}],"A":{},"a":{}}
> 
> Since JCS only is a serialization concept (parsing is unaffected), I compared the execution speed of standard serialization versus canonicalized serialization.
> 
> Using https://www.npmjs.com/package/canonicalize the performance penalty was about 2.4 compared to JSON.stringify().
> Using my homegrown JSON tools written in Java having an integrated "canonicalize" serializer option the performance penalty was about 1.4
> 
> Anders
> 
> 1] https://tools.ietf.org/html/draft-rundgren-json-canonicalization-scheme-01
> 
> _______________________________________________
> jose mailing list
> jose@ietf.org
> https://www.ietf.org/mailman/listinfo/jose