diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2024-03-31 15:00:00 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2024-04-01 10:41:46 +0200 |
commit | 734bd005aa0fa955cf1a46d3a60a4d6ef5e7e3d1 (patch) | |
tree | 28e48c30e5916247065e8e66d9a80d9991ec1c2b /lisp/emacs-lisp/lisp.el | |
parent | f178a6d8006f1e8afe06bb71d0a413622d73f131 (diff) | |
download | emacs-734bd005aa0fa955cf1a46d3a60a4d6ef5e7e3d1.tar.gz emacs-734bd005aa0fa955cf1a46d3a60a4d6ef5e7e3d1.tar.bz2 emacs-734bd005aa0fa955cf1a46d3a60a4d6ef5e7e3d1.zip |
Faster JSON parsing
Speed up JSON parsing substantially by only UTF-8-parsing string
literals and only exactly once. Previously, json-parse-string always
first parsed the entire input and copied it to a new string, and then
validated each string literal twice.
We no longer create an extra new string when interning an alist key,
nor do we garble plist keys with Unicode characters.
* src/lread.c (intern_c_multibyte): New.
* src/json.c (json_encode): Remove.
(utf8_error): New.
(json_parse_string): Faster and more careful UTF-8 decoding.
Create and return a new multibyte string or symbol without extra
decoding. All callers adapted.
(Fjson_parse_string): Skip expensive input pre-decoding.
* test/src/json-tests.el (json-parse-string/object-unicode-keys)
(json-parse-string/short): New.
(json-parse-string/string, json-parse-string/invalid-unicode):
Adapt tests.
* etc/NEWS: Mentioned change in errors.
Diffstat (limited to 'lisp/emacs-lisp/lisp.el')
0 files changed, 0 insertions, 0 deletions