[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#31138: Native json slower than json.el

From: Eli Zaretskii
Subject: bug#31138: Native json slower than json.el
Date: Sun, 21 Apr 2019 22:03:07 +0300

> From: yyoncho <address@hidden>
> Date: Sun, 21 Apr 2019 16:28:02 +0300
> Cc: Dmitry Gutov <address@hidden>, S├ębastien Chapuis <address@hidden>, 
>       address@hidden
>  The issue here is not that the library is some code not written by the
>  Emacs project, because we do the same with text generated by Emacs
>  Lisp programs.  Bugs can happen in both external libraries and in code
>  written by Emacs programmers.
> I am a bit confused, (maybe I am talking nonsense) but if the input is 
> already an emacs lisp string doesn't that
> mean that we should not decode it since it is already validated?

If the text is multibyte text, yes.  But Lisp programs can also
generate unibyte text.

> But even if we had to convert it, we can do it
> once(e. g. apply decode string on the input string) instead of doing that for 
> each string in the JSON and
> eventually yield performance improvement?

We can do that, yes.  I don't know what kind of speedup this will get
us, we should measure that.

> For a reference, I have compared the performance of read-from-string
> with the json equivalent and it is ~3 times faster(if memory serves
> me right).

read-from-string doesn't decode.  You need to time
decode-coding-string when the string is the entire JSON.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]