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: [PATCH] Implement fast verisons of json-parse functions Date: Sat, 30 Mar 2024 10:43:59 +0300 Message-ID: <865xx4dv0g.fsf@gnu.org> References: <87h6h2rsgn.fsf@gmail.com> <867chy3vpm.fsf@gnu.org> <87cyrqrqnb.fsf@gmail.com> <865xxi3tsu.fsf@gnu.org> <874jd2rnwj.fsf@gmail.com> <864jd14lqs.fsf@gnu.org> <87edc1rzig.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9608"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: =?utf-8?Q?G=C3=A9za_Herman?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 30 08:45:17 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 1rqTOt-0002Di-NE for ged-emacs-devel@m.gmane-mx.org; Sat, 30 Mar 2024 08:45:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rqTNn-0005qA-FS; Sat, 30 Mar 2024 03:44:07 -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 1rqTNl-0005pz-Fd for emacs-devel@gnu.org; Sat, 30 Mar 2024 03:44:05 -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 1rqTNj-0001yW-EP; Sat, 30 Mar 2024 03:44:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=lY8YcT0ID6b97lTRAgF6fk2HJh0P1Xk3eSv3ZLES+gQ=; b=iGovuccW9NUR0r5mP5Yb dLAySxJiGz9TX40YgHu0emEpTlvKyThMUpimDEnrH7L9kLHpL4MSmYts0sKu/uEMEz9oBkMPRuJEp ic1/zEACLEntE5JIb0g+vfWgzJFTtQzitOpEh5e/xw1Lozu+NnGqzmq55Bee/noro4/opGJIPPGcX s0OL86efu5k1fKbLvixoTNgqJSjTit0RwNSnlLEgqG6JAk3834j2uL12E2SO0v1CicxNudWklerP5 DxfH1uVcHovEUbUy1ayysAAtNZwiicFS5mWYdxBA/cmviqR5rSpN9It8RHUfRoduW+N8ZQhMtlkbh 1Y4O6D9Bs//5Ew==; In-Reply-To: <87edc1rzig.fsf@gmail.com> (message from Herman, =?utf-8?Q?G?= =?utf-8?Q?=C3=A9za?= on Sat, 23 Mar 2024 11:40:41 +0100) 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:317384 Archived-At: > From: Herman, Géza > Cc: Géza Herman , > emacs-devel@gnu.org > Date: Sat, 23 Mar 2024 11:40:41 +0100 > > I attached the latest version of the parser. I reverted the Lisp > vector based workspace to use a malloc based one, and added a note > regarding that the GC most not run during parsing. I also > implemented some additional optimizations, this version runs ~10x > faster on my LSP dataset. I also run the parser on all the JSON > files I found on my computer (~60,000 files, 1.5 GiB), no problems > were found. The parser runs ~6.5x faster (3.5 sec vs 23.4 sec) on > this dataset. Thanks. I installed this on the master branch, after adding the required commit log messages and some cleanup of unused functions. However: . 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 Here are the failed tests; please see how to fix them: Test json-parse-string/invalid-unicode backtrace: signal(ert-test-failed (((should-error (json-parse-string "[\"\200\" ert-fail(((should-error (json-parse-string "[\"\200\"]") :type 'json ert--should-error-handle-error((closure ((form-description-404 (shou (condition-case -condition- (unwind-protect (setq value-402 (apply f (let ((errorp405 nil) (form-description-fn-406 #'(lambda nil form-de (let (form-description-404) (let ((errorp405 nil) (form-description- (let ((value-402 'ert-form-evaluation-aborted-403)) (let (form-descr (let* ((fn-400 #'json-parse-string) (args-401 (condition-case err (l (closure (t) nil (let* ((fn-395 #'fboundp) (args-396 (condition-case #f(compiled-function () #)() handler-bind-1(#f(compiled-function () #)() handler-bind-1(#f(compiled-function () #)() handler-bind-1(#f(compiled-function () #