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: Thierry Volpiatto <thievol <at> posteo.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 63861 <at> debbugs.gnu.org
Subject: bug#63861: [PATCH] pp.el: New "pretty printing" code
Date: Wed, 07 Jun 2023 16:19:38 +0000
[Message part 1 (text/plain, inline)]
Stefan Monnier <monnier <at> 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
[signature.asc (application/pgp-signature, inline)]

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.