From: Thierry Volpiatto <thievol@posteo.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 63861@debbugs.gnu.org
Subject: bug#63861: [PATCH] pp.el: New "pretty printing" code
Date: Wed, 07 Jun 2023 16:19:38 +0000 [thread overview]
Message-ID: <871qinme9q.fsf@posteo.net> (raw)
In-Reply-To: <jwv5y7zxppo.fsf-monnier+emacs@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1695 bytes --]
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> I tried your code and it looks very slow (but looks nice once printed).
>> Testing on my bookmark-alist printed in some buffer.
>> Here with a slightly modified version of pp-buffer (not much faster than
>> the original one):
>>
>> (benchmark-run-compiled 1 (pp-buffer))
>> => (6.942135047 0 0.0)
>> And here with your version (using pp-region):
>> (benchmark-run-compiled 1 (pp-buffer))
>> => (46.141411097 0 0.0)
>>
>> For describe variable I use a modified version of `pp` which is very
>> fast (nearly instant to pretty print value above) but maybe unsafe with
>> some vars, didn't have any problems though, see
>> https://github.com/thierryvolpiatto/emacs-config/blob/main/describe-variable.el.
>
> Beside the actual way we choose when to insert \n, the main difference
> w.r.t performance tends to come from the fact that the new code relies
> on `lisp-indent-line` rather than `lisp-indent-region`.
>
> In many cases it doesn't make much difference performancewise, but
> indeed there are cases where the difference is significant (more
> specifically where it makes the code O(N²) rather than O(N)).
> I've been using the patch below for a while and I should probably
> include it the `pp-region` patch.
>
> Can you check whether it helps for your case?
No, more or less the same:
(benchmark-run-compiled 1 (pp-buffer))
=> (48.501764747 0 0.0)
I have modified my code so that it can be used outside help, you can
test it with tv/pp-region. Here with always the same test buffer:
(benchmark-run-compiled 1 (tv/pp-region (point-min) (point-max)))
=> (0.259444169 0 0.0)
--
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 686 bytes --]
next prev parent reply other threads:[~2023-06-07 16:19 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 22:50 bug#63861: [PATCH] pp.el: New "pretty printing" code Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-03 5:53 ` Eli Zaretskii
2023-06-03 18:18 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-03 18:58 ` Eli Zaretskii
2023-06-12 20:21 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-13 10:55 ` Eli Zaretskii
2023-06-16 18:26 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-17 5:39 ` Eli Zaretskii
2023-06-17 16:13 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-17 16:42 ` Eli Zaretskii
2023-06-17 22:08 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-04 3:25 ` Visuwesh
2023-06-07 15:48 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-09 3:21 ` Visuwesh
2023-06-09 14:59 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-09 15:09 ` Ihor Radchenko
2023-06-09 15:26 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-09 15:59 ` Visuwesh
2023-06-09 16:04 ` Visuwesh
2023-06-05 16:12 ` Juri Linkov
2023-06-07 15:21 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-07 18:12 ` Juri Linkov
2023-06-07 19:43 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-07 14:10 ` Thierry Volpiatto
2023-06-07 15:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-07 16:19 ` Thierry Volpiatto [this message]
2023-06-07 21:18 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-08 16:15 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-08 18:08 ` Thierry Volpiatto
2023-06-08 22:35 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-09 0:07 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-09 5:22 ` Thierry Volpiatto
2023-06-20 20:56 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871qinme9q.fsf@posteo.net \
--to=thievol@posteo.net \
--cc=63861@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).