From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: JSON->lisp Mapping: Hash vs AList Date: Tue, 19 Dec 2017 17:50:39 +0000 Message-ID: References: <838te5uvee.fsf@gnu.org> <838te1qrkq.fsf@gnu.org> <49ce1429-228e-a92a-839f-312d6171e896@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a1147e32c785f660560b51bd9" X-Trace: blaine.gmane.org 1513705749 11284 195.159.176.226 (19 Dec 2017 17:49:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 19 Dec 2017 17:49:09 +0000 (UTC) Cc: emacs-devel@gnu.org To: =?UTF-8?Q?Cl=C3=A9ment_Pit=2DClaudel?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 19 18:49:04 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRM0l-0002Tq-8F for ged-emacs-devel@m.gmane.org; Tue, 19 Dec 2017 18:49:03 +0100 Original-Received: from localhost ([::1]:57082 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRM2j-0005e7-F7 for ged-emacs-devel@m.gmane.org; Tue, 19 Dec 2017 12:51:05 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47737) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRM2V-0005bu-I9 for emacs-devel@gnu.org; Tue, 19 Dec 2017 12:50:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRM2U-0005PQ-Lp for emacs-devel@gnu.org; Tue, 19 Dec 2017 12:50:51 -0500 Original-Received: from mail-qk0-x22c.google.com ([2607:f8b0:400d:c09::22c]:34948) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRM2U-0005OS-Gs for emacs-devel@gnu.org; Tue, 19 Dec 2017 12:50:50 -0500 Original-Received: by mail-qk0-x22c.google.com with SMTP id 143so8824279qki.2 for ; Tue, 19 Dec 2017 09:50:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/X2I1pxdkYB8jfiopKAZp0o+Cj4CKWMgxSlispdLB6I=; b=Eyxju7rNyuZCUodWL8CZq93XwlidIjFwbF1yCbkNZtDPn55Nn2OQafK57bAHrhmJ5o 7YFMxpfZfa8xoStDCY9udN5vy0X81Vwe7QRr914Lu0oObCGpaWDcqhWT5ojP5TqzjPHH /1jTo/bHPSJ1ParMi4lSpb//T4jq8RENjBYNaSpnJdUj3+F8eZJJ913ipsQaRIytCgnN U+0xXqZKJekE9ujNhQCW5/fNwnPnOoZVQ4/5fqzk4jrkYF3AKbFG6IRbtGObbteNTHSO Srm1uHtKioaapbeIKUCFUQGIARtNB/ihUQS+b1/c/lWUdrvCh3JT3dHPspqaIxHck/Wt M3IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/X2I1pxdkYB8jfiopKAZp0o+Cj4CKWMgxSlispdLB6I=; b=UF94tvN6Mkjmhwxu/fM30YiFSxgAGzfPYv5HuVKzhFtzy2xiCbs+G+A/LbXtnHf0eo N8XQ5lvrPKELBZF/ZaKy0gLL45YqAZe4pF4WHBeia/UPsWeaibNA1xu1BqfcPt5l8pkD C0yo6M9ryb074+nZdhYDqAIehaO01DmwoaKUc4h3qb2eOiGm9c2xRdlaVSL+m70JFZRO hfdKx5Z66GUhw57TE3g8b+bkRaGnCEiYMOzbDgN7etU+X3NWWOCJou1+A3yw09dc8Dcp v9e1L7c7bnCHXWGSF5cBHEVu+1yiqWU8+24su2l2qFEfhyfctTP8IXrnMuf5uCVhgD4h UZiQ== X-Gm-Message-State: AKGB3mJuRa69PoePPkz7Ik0ez+s/XE0fFpPqpfsqZQ9lCgUYPrtLGXt4 k2GvZdnY4V8KyW1a4Jq1IZUoxmn43RYhdQI8k/so0w== X-Google-Smtp-Source: ACJfBotCUeMnF6p7NYDMDWPp9ghs9/W2p5kOV24uErhzcI3BYoediUBBE5sRUGeRe82Im8xypcdOHRsXDg5Ky0Zs5z4= X-Received: by 10.55.31.96 with SMTP id f93mr6095775qkf.151.1513705849772; Tue, 19 Dec 2017 09:50:49 -0800 (PST) In-Reply-To: <49ce1429-228e-a92a-839f-312d6171e896@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::22c X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221253 Archived-At: --001a1147e32c785f660560b51bd9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Cl=C3=A9ment Pit-Claudel schrieb am Mo., 18. Dez. 2= 017 um 17:15 Uhr: > On 2017-12-17 12:44, Philipp Stephani wrote: > > > > + result =3D Fnreverse (result); > > > > > > Is there a reason for calling nreverse here? > > > > > > It puts the elements in the same order as the original JSON. (The > Jansson parser also retains the original > > > order.) > > > This isn't very important, just a bit nicer and less surprising. > > > > It's a potential performance hit, but if you think it's worthwhile, > > it's fine with me. > > > > I don't care much. For now I'd leave it in, we can take it out later if > it hurts performance too much. (Though people that care about performance > should probably use hashtables anyway.) > > Would it make it faster to construct the list in order, instead of > constructing it in reverse and then reversing it? > I haven't measured it. Feel free to measure whether one of the three methods (the current one, yours, inverted order) is significantly faster than the others, and send a patch if yes. --001a1147e32c785f660560b51bd9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Cl=C3= =A9ment Pit-Claudel <cpitclaude= l@gmail.com> schrieb am Mo., 18. Dez. 2017 um 17:15=C2=A0Uhr:
On 2017-12-17 12:44, Philipp Stephani wro= te:
>=C2=A0 =C2=A0 =C2=A0>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 result =3D Fnreverse (result);
>=C2=A0 =C2=A0 =C2=A0>
>=C2=A0 =C2=A0 =C2=A0>=C2=A0 Is there a reason for calling nreverse h= ere?
>=C2=A0 =C2=A0 =C2=A0>
>=C2=A0 =C2=A0 =C2=A0> It puts the elements in the same order as the = original JSON. (The Jansson parser also retains the original
>=C2=A0 =C2=A0 =C2=A0> order.)
>=C2=A0 =C2=A0 =C2=A0> This isn't very important, just a bit nice= r and less surprising.
>
>=C2=A0 =C2=A0 =C2=A0It's a potential performance hit, but if you th= ink it's worthwhile,
>=C2=A0 =C2=A0 =C2=A0it's fine with me.
>
> I don't care much. For now I'd leave it in, we can take it out= later if it hurts performance too much. (Though people that care about per= formance should probably use hashtables anyway.)

Would it make it faster to construct the list in order, instead of construc= ting it in reverse and then reversing it?

I haven't measured it. Feel free to me= asure whether one of the three methods (the current one, yours, inverted or= der) is significantly faster than the others, and send a patch if yes.
--001a1147e32c785f660560b51bd9--