[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#31138: Native json slower than json.el
From: |
Sebastien Chapuis |
Subject: |
bug#31138: 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
- bug#31138: Native json slower than json.el,
Sebastien Chapuis <=