From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.bugs Subject: bug#40693: 28.0.50; json-encode-alist changes alist Date: Wed, 29 Apr 2020 15:41:19 +0100 Message-ID: <87wo5yqrqo.fsf@tcd.ie> References: <87a738jotd.fsf@tcd.ie> <87mu6utxd1.fsf@tcd.ie> <83r1w6ziql.fsf@gnu.org> <82572c3f-fb24-0b01-06ec-47067d9219ca@yandex.ru> <83blnazdly.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="64350"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: darthandrus@gmail.com, 40693@debbugs.gnu.org, Dmitry Gutov To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 29 16:44:35 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jTnwx-000Gf0-GD for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Apr 2020 16:44:35 +0200 Original-Received: from localhost ([::1]:42606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTnww-0000t8-Is for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Apr 2020 10:44:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50374) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jTnwA-0000VS-SK for bug-gnu-emacs@gnu.org; Wed, 29 Apr 2020 10:44:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jTnuU-0000AF-71 for bug-gnu-emacs@gnu.org; Wed, 29 Apr 2020 10:43:46 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60900) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jTnuT-0000AA-Rh for bug-gnu-emacs@gnu.org; Wed, 29 Apr 2020 10:42:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jTnuT-00087j-OY for bug-gnu-emacs@gnu.org; Wed, 29 Apr 2020 10:42:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Apr 2020 14:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40693 X-GNU-PR-Package: emacs Original-Received: via spool by 40693-submit@debbugs.gnu.org id=B40693.158817128931191 (code B ref 40693); Wed, 29 Apr 2020 14:42:01 +0000 Original-Received: (at 40693) by debbugs.gnu.org; 29 Apr 2020 14:41:29 +0000 Original-Received: from localhost ([127.0.0.1]:44213 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jTntx-000870-I7 for submit@debbugs.gnu.org; Wed, 29 Apr 2020 10:41:29 -0400 Original-Received: from mail-pg1-f194.google.com ([209.85.215.194]:43797) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jTntw-00086k-Sn for 40693@debbugs.gnu.org; Wed, 29 Apr 2020 10:41:29 -0400 Original-Received: by mail-pg1-f194.google.com with SMTP id x26so1099827pgc.10 for <40693@debbugs.gnu.org>; Wed, 29 Apr 2020 07:41:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=4tpI/d4LVeWBhHU/6PUXEPhl+cmffAW3U9FgH/ELXpw=; b=gC72wp2c8VdpM0qIg8WvGmSNbbHGpwA9Y6ok64+A4XEKYO0Z3VRpT7lp0sCs45pHGZ n8+jnBp9C94JceAZEt70NOR3Hoy1FQwCEcIBZjfQKhnxMY0n3uNeBR3jsLu5AuBWLEFZ T+RLRHdjzO2MGTCgAGv1CyyNIWNngz6lHKAYVqsYzY1Dqbd8yTP4fn1290WTBH8kUcUw caEib2Ewg3dM/KEovmuzzb4HffpcPPcgP0qQ/uACYTtct6BSi4DwFh0qBuzgfCW+fVLC tBlYkZQGYYz89OQLLGEq585Y9T5BiXSzYyM93m595irdjAHcqWjt+xsUCN7hYv2sSUf9 8JQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=4tpI/d4LVeWBhHU/6PUXEPhl+cmffAW3U9FgH/ELXpw=; b=eGa0KAbWTYdEPnq0ziJ13Gl8NLP2sHQeMM5XwwvU1gKp9sE/pHkuJ+F1YcWDHOx27l zPuhNuVh1qWCy1E2sURYl6wSS4ngfwoqsRMtJ06QFuz3kpupXvW9lV/rpsWWb+SNLfmH EJ+db1g8SyhT/q+UcnjrA06dvdhDvXSM8BxpHPVikQL1Jb6J+et+fmZr34gfWReMpZaa NjcapW//lpvwBMtbIxyW3KiwKDaNHkISnH2YHHKelXFcHDqz2pEkp5761ZE3sJp1yVpC jC6CJjlXEhKFCJuDfO3TjgUJ7bu1/YrXgI2MeOazXm49shRv/YT/51SwmMeOdR2sHeb5 ZMbg== X-Gm-Message-State: AGi0PuaDXgzZ6Dctx4HipVxWR46S9lStHftQkIwcpSE7GJ6NG7n4pfM8 Wq8orppDC19lhqEnz3YvVL8VcQ== X-Google-Smtp-Source: APiQypI4R20wHJ/IJyQ3D8f/olTtCYSaVeQZF+XsYJbbvODy6X4csAc0UeYg+yeDgIzZojMzDHfgQQ== X-Received: by 2002:a63:220a:: with SMTP id i10mr5816344pgi.364.1588171282950; Wed, 29 Apr 2020 07:41:22 -0700 (PDT) Original-Received: from localhost ([2a02:8084:20e2:c380:92bd:1bfd:38fc:fae2]) by smtp.gmail.com with ESMTPSA id i25sm1187221pfo.196.2020.04.29.07.41.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 07:41:22 -0700 (PDT) In-Reply-To: <83blnazdly.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 29 Apr 2020 15:21:45 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:179313 Archived-At: Eli Zaretskii writes: >> Cc: darthandrus@gmail.com, 40693@debbugs.gnu.org >> From: Dmitry Gutov >> Date: Wed, 29 Apr 2020 15:08:57 +0300 >> >> > No one tried to come up with arguments why this has to be in emacs-27. >> >> Let me try: >> >> It fixes a bug, one which could be annoying to investigate, the fix is >> small and localized to the case when json-encoding-object-sort-predicate >> is non-nil (so pretty safe). > > It also makes the function slower. Which may be an important issue > for JSON processing. Callers that don't care about the original list > will be "punished" regardless. > > How about adding an optional argument instead, by default off, to > request this behavior? then callers who care about the original alist > could request a non-destructive operation, and others won't suffer any > slowdown. That was my first thought too. I have a local WIP branch where I am refactoring parts of json.el to improve performance, and avoiding the proposed copy-sequence is one of the fixes. I've also found a couple of test JSON files to benchmark against. >> It's not a regression from Emacs 26, though. > > Right. The reasons I thought the copy-sequence fix might be desirable in Emacs 27 are: 1. It's a simple enough fix to go into the release branch. 2. Users who enable json-encoding-object-sort-predicate are already trading off performance for sort order. In addition to the cost of sorting, hash table and plist objects have to first be converted to alists before they can be sorted. My guess is that an extra copy-sequence won't make a big difference here. 3. Users who care about sheer performance of JSON serialisation will either avoid json-encoding-object-sort-predicate or use the newer Jansson functions. I don't personally mind whether this gets into emacs-27; I just wanted to see what others thought. Thanks, -- Basil