Re: [Json] Proposed minimal change for duplicate names in objects

Nico Williams <> Sun, 07 July 2013 06:25 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id EDA5821F9DCD for <>; Sat, 6 Jul 2013 23:25:51 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -1.958
X-Spam-Status: No, score=-1.958 tagged_above=-999 required=5 tests=[AWL=0.019, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id 85cRC7VSIjcn for <>; Sat, 6 Jul 2013 23:25:46 -0700 (PDT)
Received: from ( []) by (Postfix) with ESMTP id 7A39621F9E3C for <>; Sat, 6 Jul 2013 23:25:46 -0700 (PDT)
Received: from (localhost []) by (Postfix) with ESMTP id 2C85E9405C for <>; Sat, 6 Jul 2013 23:25:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed;; h= mime-version:in-reply-to:references:date:message-id:subject:from :to:cc:content-type:content-transfer-encoding; s=; bh=G/jsqUAJB2hJnuhUVBTclYD6nbM=; b=sarlgyGCP/K YjiQriJwzPTwsCvluTq8dqv+vfCOa+rV6AU/Qlt432JZLEg1HhMUOnncFJmnDUZE RY6IeqSlgY0dEpYidpThb17eWKdKjU/hZgh1Mgn3kxym0N/wXyhgr6hWX40/CUmG 6vAmAkVd8ImkIPjR3LMloYdVZhotTFts=
Received: from ( []) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: by (Postfix) with ESMTPSA id D051294059 for <>; Sat, 6 Jul 2013 23:25:45 -0700 (PDT)
Received: by with SMTP id y10so2891136wgg.8 for <>; Sat, 06 Jul 2013 23:25:44 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=b6I1SX1LxeC//TPavw55ZjfOcdmml7I2IZzzF41lvCo=; b=ZDC/vzYqylkH6Yz8OH8ysV/1p8+2vFWtj990UcaadIYUdkAtXmBBHgfZdDp1gm27Im 8Ip4/12ZHOJPncxlvw1QzDQCLMqLxZ+KL2cF2lxlithTGojW1HMfSlX5gmV7qSBUb9E8 4RKfI8w67uwhXwRnspxPNNU/9a5AK3yskqU79K6/hB/ukdqRLpcJZdTlfsb6h6QKdJ3c a6VrQuzm3gEzUHbJqugRdMNufgxhfwrQsrKp8QTVxmp+CtySwygPTcGWqxBEJa9QqMDG 1Ke88SuE/idyBihywxmuYu1t3xOHIhEInjuWcGOKZq7CRdVPaJuoSCEdpT5rTdwqk1Fw WGSA==
MIME-Version: 1.0
X-Received: by with SMTP id ha7mr8684399wib.28.1373178344404; Sat, 06 Jul 2013 23:25:44 -0700 (PDT)
Received: by with HTTP; Sat, 6 Jul 2013 23:25:44 -0700 (PDT)
In-Reply-To: <>
References: <> <> <> <> <> <00cd01ce7a9f$19adeaa0$4d09bfe0$> <00d701ce7aa6$cc5fe700$651fb500$> <> <> <> <> <>
Date: Sun, 7 Jul 2013 01:25:44 -0500
Message-ID: <>
From: Nico Williams <>
To: Tim Bray <>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Cc: Jim Schaad <>, Tatu Saloranta <>, "" <>
Subject: Re: [Json] Proposed minimal change for duplicate names in objects
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Sun, 07 Jul 2013 06:25:52 -0000

On Sat, Jul 6, 2013 at 11:58 PM, Tim Bray <> wrote:
> I’ll assume you’re right when you say dupe detection has been measured as
> expensive at run time, but I’m thinking that if I were writing a reader I'd
> implement a hash table with a test-and-set method, so I admit I'm surprised
> by the finding.  I think I’d need to see a little more research before I’d
> accept that as a given.  -T

Dunno about Tatu, but I think the vast majority of JSON usage must be
coupled either with generic hash tables (objects/dicts/maps/whatever)
or structs (with associated schema).  For the latter dup detection may
well be more expensive than not, but probably not that much more
expensive.  For the former dup detection is essentially free.

For other use cases, like Stephen Dolan's "launch missiles" example,
dup detection might well be expensive, but maybe JSON is the wrong
tool for those use cases.

The CPU cost of dup detection doesn't concern me.  It's the
architectural implication that does: minimal state streaming parsers
are out.

I have to ask myself: are there use cases where I would want a minimal
state streaming parser?  and do I mind losing the ability to have such
a thing?  My personal, tentative answers: "yes" and "probably not,
maybe in such a case I should not use JSON".  Others will no doubt
have different answers, which brings us to...

...more retreading.

I still think the best thing to do is note the divergent
interpretations and publish Internet JSON.