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

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

bug#31138: closed (Native json slower than json.el)


From: GNU bug Tracking System
Subject: bug#31138: closed (Native json slower than json.el)
Date: Sun, 23 Aug 2020 05:51:02 +0000

Your message dated Sun, 23 Aug 2020 08:50:40 +0300
with message-id <83sgcd9ahb.fsf@gnu.org>
and subject line Re: bug#31138: Native json slower than json.el
has caused the debbugs.gnu.org bug report #31138,
regarding Native json slower than json.el
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
31138: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=31138
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: Native json slower than json.el Date: Thu, 12 Apr 2018 21:13:41 +0200 User-agent: mu4e 0.9.19; emacs 27.0.50
Hi,

I have tested the new function json-parse-string to use it in lsp-mode
and was suprised when I found out that this function is slower than
json-read-from-string from json.el:

Test with a string of 4042446 characters:
```
json-parse-string:       9,166010 seconds
json-read-from-string:   6.028625 seconds
```

I took a look at the code, and if I remove the call to
code_convert_string in json_make_string (see the attached diff),
it's way faster:

Test with a string of 4042411 characters
```
json-parse-string (without code_convert_string):
0.505582 seconds
```

Is this conversion really necessary ? Should I set some variable to avoid
this ?


By the way, what is the state of this patch:
https://lists.gnu.org/archive/html/emacs-devel/2017-12/msg00916.html
Could it be merge ?

diff --git a/src/json.c b/src/json.c
index b046d34f66..1fc976214d 100644
--- a/src/json.c
+++ b/src/json.c
@@ -219,8 +219,7 @@ json_has_suffix (const char *string, const char *suffix)
 static Lisp_Object
 json_make_string (const char *data, ptrdiff_t size)
 {
-  return code_convert_string (make_specified_string (data, -1, size, false),
-                              Qutf_8_unix, Qt, false, true, true);
+  return make_specified_string (data, -1, size, false);
 }
 
 /* Create a multibyte Lisp string from the null-terminated UTF-8
--
Sebastien Chapuis

--- End Message ---
--- Begin Message --- Subject: Re: bug#31138: Native json slower than json.el Date: Sun, 23 Aug 2020 08:50:40 +0300
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: Eli Zaretskii <eliz@gnu.org>,  sebastien@chapu.is,  yyoncho@gmail.com,
>   31138@debbugs.gnu.org
> Date: Sun, 23 Aug 2020 01:28:36 +0200
> 
> This was a very long thread, but it looks like the performance issues
> were fixed by:
> 
> commit c26556bd18f8ca1e891bd1750c9f95b21ea457b0
> Author:     Eli Zaretskii <eliz@gnu.org>
> AuthorDate: Sat Nov 23 11:27:43 2019 +0200
> 
>     Fix and speed up en/decoding of UTF-8 strings
>     
> So is there anything more to be done in this bug report?

I think this can be closed, so I've now done so.

Thanks.


--- End Message ---

reply via email to

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