bug-gnu-emacs
[Top][All Lists]
Advanced

[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 12:31:09 +0300

> Cc: address@hidden
> From: Dmitry Gutov <address@hidden>
> Date: Sun, 21 Apr 2019 12:15:59 +0300
> 
> On 21.04.2019 11:58, Eli Zaretskii wrote:
> > I profiled the code, and my results are very similar to yours.  My
> > interpretation of the results is that decoding strings that we receive
> > from the jansson library takes less than 10% of the CPU time.  So I
> > think we don't need to worry about this aspect when considering
> > parsing of JSON objects.
> 
> Eli, how did you reach that conclusion?

By adding the percentage of all the functions involved in decoding
strings.

> One: looking at the profile, libjansson is somewhere down below, and 
> most of the runtime is taken by Emacs.

I only accounted for time used by Emacs code, i.e. 100% doesn't
include the library.

> Two: while I might be misreading the profile, simply omitting the 
> decoding function call (and using the returned strings as-is) halves the 
> execution time.

You cannot use the returned string as is, you must make a Lisp string
out of it.

In any case, even if decoding takes 50% of the time we spend in Emacs
code, it is still not significant enough to justify the un-safety of
using a string that we didn't decode, because if that string ever
includes raw bytes, Emacs will surely crash.





reply via email to

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