GNU bug report logs - #63861
[PATCH] pp.el: New "pretty printing" code

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Fri, 2 Jun 2023 22:52:02 UTC

Severity: normal

Tags: patch

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Thierry Volpiatto <thievol <at> posteo.net>
Cc: 63861 <at> debbugs.gnu.org
Subject: bug#63861: [PATCH] pp.el: New "pretty printing" code
Date: Tue, 20 Jun 2023 16:56:33 -0400
> 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





This bug report was last modified 2 years and 27 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.