GNU bug report logs - #79361
minor jsonrpc optimisation suggestions

Previous Next

Package: emacs;

Reported by: Mattias Engdegård <mattias.engdegard <at> gmail.com>

Date: Mon, 1 Sep 2025 19:00:02 UTC

Severity: normal

Full log


Message #8 received at 79361 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Mattias Engdegård <mattias.engdegard <at> gmail.com>
Cc: joaotavora <at> gmail.com, 79361 <at> debbugs.gnu.org
Subject: Re: bug#79361: minor jsonrpc optimisation suggestions
Date: Tue, 02 Sep 2025 14:10:19 +0300
> Cc: João Távora <joaotavora <at> gmail.com>
> From: Mattias Engdegård <mattias.engdegard <at> gmail.com>
> Date: Mon, 1 Sep 2025 20:58:50 +0200
> 
> --- a/lisp/jsonrpc.el
> +++ b/lisp/jsonrpc.el
> @@ -548,11 +548,13 @@ initialize-instance
>      (set-process-buffer proc (get-buffer-create (format " *%s output*" name)))
>      (set-process-filter proc #'jsonrpc--process-filter)
>      (set-process-sentinel proc #'jsonrpc--process-sentinel)
> +    (set-process-coding-system proc 'binary 'binary)

Why not do this at make-process time?

>      (with-current-buffer (process-buffer proc)
>        (buffer-disable-undo)
>        (set-marker (process-mark proc) (point-min))
>        (let ((inhibit-read-only t))
>          (erase-buffer))
> +      (set-buffer-multibyte nil)

I would move this to make it the first thing we do in the buffer.

> +        ;; `json-read' requires decoded input.
> +        (json-read-from-string (decode-coding-string (buffer-string) 'utf-8)))))

Should be utf-8-unix, I believe, since JSON requires a literal \n as a
newline convention.

And yes, it would be nice to have timings.




This bug report was last modified today.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.