From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: I created a faster JSON parser Date: Mon, 11 Mar 2024 15:29:18 +0200 Message-ID: <867ci8vqvl.fsf@gnu.org> References: <87a5n96mb5.fsf@gmail.com> <20240309203725.x456m7c6soxtgj6q@nullprogram.com> <86jzmawqbm.fsf@gnu.org> <87ttldydf2.fsf@posteo.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9468"; mail-complaints-to="usenet@ciao.gmane.io" Cc: wellons@nullprogram.com, geza.herman@gmail.com, emacs-devel@gnu.org To: Philip Kaludercic Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Mar 11 14:30:28 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rjfjY-0002En-Nw for ged-emacs-devel@m.gmane-mx.org; Mon, 11 Mar 2024 14:30:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjfiY-0004vc-5i; Mon, 11 Mar 2024 09:29:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rjfiU-0004vJ-HF for emacs-devel@gnu.org; Mon, 11 Mar 2024 09:29:22 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rjfiT-0005wc-3r; Mon, 11 Mar 2024 09:29:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=VMawXkryN1/PAjzfjSY1gzzjEbEIWl64UNTpNYU+ipk=; b=YhXtFyLBenBL FBAtqZ7/W76VrA843422GLMfFtQYlaSy4Fk83jgmuacYBjbOnQarTdH/1CxcQ8niYvSeZqaS7dCqn w0V0qp8wJbRUpDFBdi15boddC3raWEvQ0z5AgtYP7EUlgzh2IB8/IZv68lIFld1zhlnGvJX7FdBqj NSE8ThokZ3vfwSGfZHq1aBr37tOJooWEd2KoktOcECudxDGPZdOxkalL2BOLT4KMHUUGaMeClQ3FQ 1ml4ZMyYzWe/JeuAz2wlEPgEuTO2aKl0j4vc+Y+bucVoCvGUDpDrVrsgBAVbpyFVkRyyfOwdZLPZ8 64iTHCuPqOukXrxNlbbhIg==; In-Reply-To: <87ttldydf2.fsf@posteo.net> (message from Philip Kaludercic on Sun, 10 Mar 2024 21:39:29 +0000) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:316999 Archived-At: > From: Philip Kaludercic > Cc: Christopher Wellons , geza.herman@gmail.com, > emacs-devel@gnu.org > Date: Sun, 10 Mar 2024 21:39:29 +0000 > > Eli Zaretskii writes: > > >> Date: Sat, 9 Mar 2024 15:37:25 -0500 > >> From: Christopher Wellons > >> Cc: "emacs-devel@gnu.org" > >> > >> Despite the obvious care which with this was written, I personally would > >> not adopt a JSON parser that had not been thoroughly fuzz tested under > >> Address Sanitizer and Undefined Behavior Sanitizer. Fuzzing is incredibly > >> effective at finding defects, and it would be foolish not to use it in its > >> ideal circumstances. Normally it's not difficult and requires only a few > >> lines of code. But this JSON parser is tightly coupled with the Emacs Lisp > >> runtime, which greatly complicates things. I couldn't simply pluck it out > >> by itself and drop it in, say, AFL++. > > > > That's okay, we can start by making this an optional feature, and > > consider making it the default after a couple of major releases; > > meanwhile, any problems will be detected and reported. > > > > However, it would make much more sense to consider switching to this > > code if it also could handle producing JSON output, thus making > > libjansson unnecessary when we decide to switch. > > If libjansson is not available, it should still be possible to use this > faster parser, while falling back to json.el for generating JSON? From > what I understand, the main issue people have with JSON is the parsing > bottleneck, right? What you describe are possible fallbacks, but I would prefer not to use any fallback at all, but instead have a full C implementation. (Using json.el has one unfortunate disadvantage that it's incompatible with the json.c APIs.)