unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: contovob@tcd.ie, darthandrus@gmail.com, 40693@debbugs.gnu.org
Subject: bug#40693: 28.0.50; json-encode-alist changes alist
Date: Wed, 29 Apr 2020 17:28:05 +0300	[thread overview]
Message-ID: <349d9b1b-4659-907e-c6e1-30cdf052c87f@yandex.ru> (raw)
In-Reply-To: <83blnazdly.fsf@gnu.org>

On 29.04.2020 15:21, Eli Zaretskii wrote:
>> Cc: darthandrus@gmail.com, 40693@debbugs.gnu.org
>> From: Dmitry Gutov <dgutov@yandex.ru>
>> 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.

It's a somewhat fair point (copy-sequence is much faster than sort, 
usually, but if we include GC time, it can be significant). The way 
json-encoding-object-sort-predicate is implemented, though, it's not 
very performance-oriented.

Applications like lsp-mode aren't going to use this variable, so they 
shouldn't be hit (and it isn't supported in native JSON either).

On that subject, users really shouldn't set it either. Rather, any 
user-facing feature that outputs JSON, when this behavior could be 
desirable, should have its own tweaking knob.

> 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.

The current behavior is unsafe, that's the problem. Also, 
json-encode-alist is called in a recursive fashion, so it'd have to be a 
global variable instead.





  reply	other threads:[~2020-04-29 14:28 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-18  2:59 bug#40693: 28.0.50; json-encode-alist changes alist Ivan Andrus
2020-04-18 17:29 ` Dmitry Gutov
2020-04-18 21:00   ` Ivan Andrus
2020-04-18 23:13   ` Michael Heerdegen
2020-04-19  0:10     ` Dmitry Gutov
2020-04-19  0:29       ` Michael Heerdegen
2020-04-19  0:33     ` Basil L. Contovounesios
2020-04-19  0:34   ` Basil L. Contovounesios
2020-04-29 10:11     ` Basil L. Contovounesios
2020-04-29 10:30       ` Eli Zaretskii
2020-04-29 12:08         ` Dmitry Gutov
2020-04-29 12:21           ` Eli Zaretskii
2020-04-29 14:28             ` Dmitry Gutov [this message]
2020-04-29 14:40               ` Eli Zaretskii
2020-04-29 15:02                 ` Dmitry Gutov
2020-04-29 15:07                   ` Eli Zaretskii
2020-04-29 14:41             ` Basil L. Contovounesios
2020-05-18  1:24               ` Basil L. Contovounesios
2020-05-18 14:27                 ` Eli Zaretskii
2020-05-18 22:50                 ` Dmitry Gutov
2020-05-18 23:50                 ` João Távora
2020-05-21 21:14                   ` Basil L. Contovounesios
2020-05-21 22:16                     ` João Távora
2020-05-22 14:54                       ` Basil L. Contovounesios
2020-05-22 20:14                         ` João Távora
2020-05-23 16:13                           ` Basil L. Contovounesios
2020-05-23 19:40                             ` João Távora
2020-05-23 22:41                               ` Basil L. Contovounesios
2020-05-23 22:45                                 ` João Távora
2020-04-19 20:35 ` Paul Eggert
2020-04-19 21:01   ` Drew Adams
2020-04-19 22:14     ` Paul Eggert
2020-04-19 22:29       ` Michael Heerdegen
2020-04-19 23:59         ` Paul Eggert
2020-04-20  0:25           ` Michael Heerdegen
2020-04-20  0:32             ` Paul Eggert
2020-04-20  0:57               ` Michael Heerdegen
2020-04-20  2:55                 ` Paul Eggert
2020-04-20 14:56                   ` Eli Zaretskii
2020-04-20  5:45                 ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=349d9b1b-4659-907e-c6e1-30cdf052c87f@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=40693@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    --cc=darthandrus@gmail.com \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).