From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#63861: [PATCH] pp.el: New "pretty printing" code Date: Tue, 20 Jun 2023 16:56:33 -0400 Message-ID: References: <87edmnics1.fsf@posteo.net> <87bkhpvm35.fsf@posteo.net> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10314"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 63861@debbugs.gnu.org To: Thierry Volpiatto Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 20 22:57:22 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1qBiPh-0002UQ-0Z for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 20 Jun 2023 22:57:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBiPP-0003Ea-NE; Tue, 20 Jun 2023 16:57:03 -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 1qBiPO-0003EH-9c for bug-gnu-emacs@gnu.org; Tue, 20 Jun 2023 16:57:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qBiPO-0002KO-1K for bug-gnu-emacs@gnu.org; Tue, 20 Jun 2023 16:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qBiPN-00074F-RL for bug-gnu-emacs@gnu.org; Tue, 20 Jun 2023 16:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Jun 2023 20:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63861 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 63861-submit@debbugs.gnu.org id=B63861.168729460327134 (code B ref 63861); Tue, 20 Jun 2023 20:57:01 +0000 Original-Received: (at 63861) by debbugs.gnu.org; 20 Jun 2023 20:56:43 +0000 Original-Received: from localhost ([127.0.0.1]:59859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBiP4-00073a-PQ for submit@debbugs.gnu.org; Tue, 20 Jun 2023 16:56:43 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:45335) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBiP3-00073O-8M for 63861@debbugs.gnu.org; Tue, 20 Jun 2023 16:56:41 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 2AEC81001FC; Tue, 20 Jun 2023 16:56:35 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 15159100023; Tue, 20 Jun 2023 16:56:34 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1687294594; bh=Bas952RT09vm2ggQt8bwoGj6v8OsiFWlp1oYrW8Sncw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=S9eFVjIsCqeXHcsUCdX6H0GuBxzHA+dWWgFq9+bMRMG8nPXWwBTEeHCAJjq9Z96BY HYnPPTTbF7pvIxZSBfkvqxcXNw54RpjIm3eIPLlxNm46XxsMemoMdoZSiGZ+wSCam5 EU6St0hQ4ZbdHZxrS5meQk8NrfwVQhatt2pJIMDZhkouurXbyc0eruOJp+cVi0dPY5 xYD0dgOGgVEXCZc6igz/fQFeBqWTSeyfcg1a8fJIjOQSJa2Z3qamYczqBha9seWBxz qSVfACQoLu9eXC+9O4VoIvPl9KhaPTQLMmoQ3lQ9a7o+JhC/T4SszN23xMrBwET3Py QBW5fXrOk9YFA== Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 037ED120147; Tue, 20 Jun 2023 16:56:34 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Thu, 08 Jun 2023 18:35:05 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:263778 Archived-At: > So, by file, from fastest to slowest: > > foo.el (0.859482743 0 0.0) (pp-buffer) t > foo.el (0.890402623 0 0.0) (pp-buffer) nil > foo.el (4.62344853 4 1.7225397670000002) (tv/pp-region (point-min) (point-max)) t > foo.el (4.687414465 4 1.7116580980000002) (tv/pp-region (point-min) (point-max)) nil > foo.el (7.932661181 1 0.3435169600000001) (pp-region (point-min) (point-max)) t > foo.el (196.183345212 1 0.618591124) (pp-region (point-min) (point-max)) nil > foo.el (2997.739238575 505 105.82851685700001) (let ((s (read (current-buffer)))) (erase-buffer) (pp-emacs-lisp-code s)) t [...] > We also see that `pp-emacs-lisp-code` is *much* slower. I don't include > other results for this function in this email because they're still > running :-) OK, they're done running (well, I had to re-run them because of a power failure in between). The tests failed on `test-load-history.el` with: Error: wrong-type-argument (number-or-marker-p cl--defmethod-doc-pos) so it looks like it tickles a bug somewhere in `pp-emacs-lisp-code`. As for the performance: "foo.el" (3207.572643287 505 111.459754959) (... (pp-emacs-lisp-code s)) t "foo.el" (121171.97145393 692 103.67438615900001) (... (pp-emacs-lisp-code s)) nil "test-bookmark-alist.el" (102462.563603419 5456 921.614736375) (... (pp-emacs-lisp-code s)) t "test-bookmark-alist.el" (191188.84323175802 7493 847.82675889) (... (pp-emacs-lisp-code s)) nil So the `lisp-ppss` patch speeds up `pp-emacs-lisp-code` by a factor 37x on `foo.el` and a factor a bit less than 2x for `test-bookmark-alist.el`. We also see that `pp-emacs-lisp-code` (with the `lisp-ppss` patch) is more than 300x slower than the new `pp-fill` code on `foo.el` and more than 3000x slower than the new `pp-fill` code on `test-bookmark-alist.el`. Admittedly, these are not cases for which that code was designed (these files hold data rather than code). Stefan