GNU bug report logs - #20154
25.0.50; json-encode-string is too slow for large strings

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Fri, 20 Mar 2015 14:27:01 UTC

Severity: normal

Found in version 25.0.50

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 20154 <at> debbugs.gnu.org
Subject: bug#20154: 25.0.50; json-encode-string is too slow for large strings
Date: Sun, 22 Mar 2015 21:03:19 +0200
On 03/22/2015 08:32 PM, Eli Zaretskii wrote:

> You said you need to encode everything on every keystroke, so I was

That was a simplification: "every keystroke" is an approximate 
description of frequency. But anyway, not every keystroke inserts a 
character. Some delete them, some invoke various commands, which may do 
complex things to buffer contents.

> wondering why you couldn't encode just the new keystroke, and append
> the result to what you already encoded earlier.
> Then send everything
> to the server, as it expects.  The problem is in encoding, not in
> sending.

The server expects a certain JSON-encoded structure. You can't just 
append stuff at the end, that wouldn't be valid JSON.

I suppose you could first encode a "skeleton" alist, with some tagged 
values replacing the values that you'd expect to be big strings, and 
then substitute the values in before sending.

I'm sure you can imagine the (admittedly rare) edge cases when this will 
break, and it imposes new constraints on the organization of the code: 
where you could before just pass Emacs structures between functions to 
be encoded at the end just before sending, now you have to worry about 
the stuff above.




This bug report was last modified 10 years and 38 days ago.

Previous Next


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