[Top][All Lists]

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

bug#25122: 24.5; function describe-variable hangs on large variables

From: npostavs
Subject: bug#25122: 24.5; function describe-variable hangs on large variables
Date: Sat, 11 Mar 2017 00:40:03 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Thierry Volpiatto <address@hidden> writes:
> I don't think it would be as fast as printing one by one each elements.
> What is slow is printing the whole object.
> See how bookmark file is saved, it was taking more than one minute for
> my bookmarks before printing one by one, now it is instant or nearly.

Actually, it's the indent-sexp on the whole object that takes time.
Possibly we could sacrifice some indentation correctness if the printed
representation is big.

I've been attempting an alternate approach which prettyprints the object
while scanning it instead of the current way of printing and then
reindenting.  Without optimizing, it's about 3 times as fast as the
current pp (it's the pp-prin1 in the benchmarks below), though more than
3 times slower than your mapc pp trick.  On the other hand, it also
doesn't yet handle function-specific indentation or any compound
structure apart from lists, so I'm not sure if it will end up being much

(benchmark 1 '(with-temp-buffer (pp-prin1 long-list (current-buffer)) nil)) 
"Elapsed time: 3.391232s (0.565806s in 11 GCs)"
(benchmark 1 '(progn (pp-to-string long-list) nil))                         
"Elapsed time: 9.988515s (0.148034s in 3 GCs)"
(benchmark 1 '(progn (with-output-to-string (mapc 'pp long-list)) nil))     
"Elapsed time: 0.983493s (0.144424s in 3 GCs)"
(benchmark 1 '(progn (cl-prin1-to-string long-list) nil))                   
"Elapsed time: 0.511617s (0.152483s in 3 GCs)"
(benchmark 1 '(progn (prin1-to-string long-list) nil))                      
"Elapsed time: 0.029320s"

Attachment: v1-0001-Initial-draft-of-new-pretty-printer-Bug-25122.patch
Description: draft patch

reply via email to

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