From: Eli Zaretskii <eliz@gnu.org>
To: "Géza Herman" <geza.herman@gmail.com>,
"Mattias Engdegård" <mattiase@acm.org>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] Implement fast verisons of json-parse functions
Date: Sat, 30 Mar 2024 16:00:30 +0300 [thread overview]
Message-ID: <86plvbdgcx.fsf@gnu.org> (raw)
In-Reply-To: <871q7snffr.fsf@gmail.com> (message from Herman, Géza on Sat, 30 Mar 2024 11:50:19 +0100)
> From: Herman, Géza <geza.herman@gmail.com>
> Cc: Géza Herman <geza.herman@gmail.com>,
> emacs-devel@gnu.org
> Date: Sat, 30 Mar 2024 11:50:19 +0100
>
>
> > . 3 tests in test/src/json-tests.el are now failing, where
> > they
> > succeeded before; see the log at the end
> > . the times of the relevant tests don't seem to be faster than
> > the libjansson version, perhaps because this is an
> > unoptimized
> > build
>
> 3 test failures:
> 1. Handling of utf-8 decode errors: the new parser emits
> json-utf8-decode-error instead of json-parse-error (this is what
> the test expects). I can fix this by modifying the test
OK, but we will need to mention this in NEWS as an incompatible
change.
> 2. Handling of a single \0 byte: the new parser emits
> json-end-of-file. I think this is not the best error kind for
> this case, so I'll modify the parser to emit json-parse-error
> instead. This is still different what the test expects
> (wrong-type-argument), but I think there is no reason to treat
> zero bytes specially. Considering the JSON spec, it's the same
> error as any other unexpected byte value.
Does JSON allow null bytes in its strings? If not, why
wrong-type-argument is not TRT?
> 3. Handling objects with duplicate keys. That's an interesting
> one. With alist/plist objects, the old parser removed duplicate
> members, but the new parser doesn't remove such members, it keeps
> them all. The JSON spec doesn't really say anything about this
> case, so I think we're free to do anything we like. Mattias
> Engdegård had an interesting idea: what if we put alist/plist
> members in reversed order? This way, if one uses assq/plist-get to
> get values by keys, the behavior will be consistent with the hash
> table representation (which keeps that last value of duplicate
> keys). I like the idea of consistency, but I don't like that the
> elements will become reversed after parsing. I had the idea that
> if the hash table kept the first value of duplicate keys, then
> we'd also have consistency. What do you think?
I think we should modify the expected results of the test to match the
new behavior, and leave the order as it is now.
But please also compare with what the Lisp implementation does in
these cases, as that could give us further ideas or make us
reconsider.
Mattias, any comments or suggestions?
next prev parent reply other threads:[~2024-03-30 13:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-19 18:23 [PATCH] Implement fast verisons of json-parse functions Herman, Géza
2024-03-19 18:47 ` Eli Zaretskii
2024-03-19 18:50 ` Herman, Géza
2024-03-19 19:28 ` Eli Zaretskii
2024-03-19 19:50 ` Herman, Géza
2024-03-20 3:37 ` Eli Zaretskii
2024-03-23 10:40 ` Herman, Géza
2024-03-23 11:11 ` Eli Zaretskii
2024-03-30 7:43 ` Eli Zaretskii
2024-03-30 10:50 ` Herman, Géza
2024-03-30 13:00 ` Eli Zaretskii [this message]
2024-03-30 18:36 ` Herman, Géza
2024-03-30 20:18 ` [External] : " Drew Adams
2024-03-30 20:51 ` Herman, Géza
2024-03-30 23:28 ` Drew Adams
2024-03-31 5:08 ` Eli Zaretskii
2024-03-31 14:51 ` Mattias Engdegård
2024-03-31 15:44 ` Eli Zaretskii
2024-04-01 8:48 ` Mattias Engdegård
2024-04-01 16:54 ` Herman, Géza
2024-03-31 17:48 ` Adam Porter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86plvbdgcx.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=geza.herman@gmail.com \
--cc=mattiase@acm.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.