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 14:59:37 +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 13:38:48 +0100
> 
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> From: Herman, Géza <geza.herman@gmail.com>
> >> Date: Fri, 08 Mar 2024 11:27:16 +0100
> >>
> >> This parser runs 8-9x faster than the jansson based parser on 
> >> my
> >> machine (tested on clangd language server messages).
> >
> > How does it do that?  Can you summarize the main ideas of your
> > implementation, which make it so much faster?
> 
> My parser creates Lisp objects during parsing, there is no 
> intermediate step as Emacs has with jansson.  With jansson, there 
> are a lot of allocations, which my parser doesn't have (my parser 
> has only two buffers, which exponentially grow. There are no other 
> allocations).  But even ignoring performance loss because of 
> mallocs (on my dataset, 40% of CPU time goes into malloc/free), I 
> think parsing should be faster, so maybe jansson is not a fast 
> parser in the first place.

Thanks.

So, if you are willing to contribute this code to Emacs, what is left
is:

  . 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;
  . thoroughly test the code on the available test suites (or maybe
    you already did);
  . for you to assign the copyright to the FSF, without which we
    cannot accept such a substantial contribution

As an additional idea: perhaps initially we'd want to have a
configure-time option to either use your parser or jansson, to make
the migration and comparison easier.  What do others think about this?



reply via email to

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