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

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

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


From: Stefan Monnier
Subject: bug#25122: 24.5; function describe-variable hangs on large variables
Date: Sat, 11 Mar 2017 10:21:53 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

>           (cl-letf (((symbol-function 'pp)
>                      (lambda (object &optional stream)
>                        (let ((fn (lambda (ob &optional stream)
>                                    (princ (pp-to-string ob)
>                                           (or stream standard-output))
>                                    (terpri)))
>                              (print-circle t))
>                          (if (consp object)
>                              (progn
>                                (insert "\n(")
>                                (mapc fn object)
>                                (cl-letf (((point) (1- (point))))
>                                  (insert ")")))
>                              (funcall fn object stream))))))

Hmm... I wonder why this would be faster.  In the past, the
implementation of `print-circle` had a poor complexity, but we fixed
that around Emacs-24, IIRC so it now uses a hash-table and should have
O(n) complexity, which means that pp shouldn't be slower than (mapc
#'pp).


        Stefan





reply via email to

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