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: Eli Zaretskii
Subject: Re: I created a faster JSON parser
Date: Fri, 08 Mar 2024 16:10:15 +0200

> 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
> 
> 
> >   . clean up the code (e.g., currently it still calls the 
> >   function
> >     that on MS-Windows loads the jansson DLL, which is now 
> >     unneeded)
> >     and adjust it to our style and conventions;
> I can remove the WINDOWSNT related #ifs.  Are there any more 
> comments?  I formatted my code with clangd, is there anything else 
> that should be done?

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).
 . The code must not call malloc/realloc/free, but their x* variants,
   xmalloc/xrealloc/xfree.
 . The names should be changed to remove the "my_" and "My" prefixes.
 . Many functions should have a commentary before them explaining
   their purpose and use, the exception is short function whose
   purpose is clear from reading the code.
 . Some of the generic 'json-parse-error' errors should probably be
   more specific; for example, UTF-8 encoding problems should be
   flagged as such.
 . 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.

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.

There could be other issues as well.

> >   . thoroughly test the code on the available test suites (or 
> >   maybe
> >     you already did);
> I tested it on github.com/nst/JSONTestSuite, it passes all "y_" 
> and "n_" tests in the directory "test_parsing".  If you're aware 
> of other test repositories, I'm happy to test on them as well.

I don't know about such test suites, but maybe someone else does.

> >   . for you to assign the copyright to the FSF, without which we
> >     cannot accept such a substantial contribution
> Can you please send me the necessary documents?

Sent off-list.

Thanks.



reply via email to

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