emacs-devel
[Top][All Lists]
Advanced

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

Re: I created a faster JSON parser


From: Herman , Géza
Subject: Re: I created a faster JSON parser
Date: Fri, 08 Mar 2024 16:20:40 +0100


Eli Zaretskii <eliz@gnu.org> writes:

From: Herman, Géza <geza.herman@gmail.com>
Cc: Géza Herman <geza.herman@gmail.com>,
 emacs-devel@gnu.org
Date: Fri, 08 Mar 2024 14:12:19 +0100
The following is based on an initial reading of the patch:

. Redundant braces (for blocks of a single code line) is one issue. . The way you break a long line at the equals sign '=' is another (we
   break after '=', not before).
I used clang-format to format my code (I use a completely different coding style). I see that clang-format is configured this way in Emacs. Shouldn't BreakBeforeBinaryOperators be set to None or NonAssignment in .clang-format?

. The code which handles integers seems to assume that 'unsigned long' is a 64-bit type? if so, this is not true on Windows; please see how
   we handle this elsewhere in Emacs, in particular in the
   WIDE_EMACS_INT case.
That was a mistake on my part, though a different (but similar) one. I originally used a 64-bit type, but then changed it to long, because of 32-bit architectures. The idea is to use a type which likely has the same size as a CPU register. So I think long is OK, I just need to change the thresholds to ULONG_MAX. Or I think I'll use ckd_* functions as Collin suggested.

A more general comment is that you seem to be parsing buffer text assuming it's UTF-8? If so, this is not accurate, as the internal representation is a superset of UTF-8, and can represent characters
above 0x10FFFF.
When does a buffer have characters above 0x10ffff? I supposed that a JSON shouldn't contain characters that are out of range. But if the solution is to just remove the upper-range comparison, I can do that easily.

Can you please send me the necessary documents?

Sent off-list.
Thanks!



reply via email to

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