bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#63861: [PATCH] pp.el: New "pretty printing" code


From: Stefan Monnier
Subject: bug#63861: [PATCH] pp.el: New "pretty printing" code
Date: Tue, 20 Jun 2023 16:56:33 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

> 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






reply via email to

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