GNU bug report logs - #25122
24.5; function describe-variable hangs on large variables

Previous Next

Package: emacs;

Reported by: Boruch Baum <boruch_baum <at> gmx.com>

Date: Tue, 6 Dec 2016 02:21:02 UTC

Severity: minor

Tags: fixed, patch

Merged with 13439, 21717

Found in versions 24.4.50, 24.5

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


Message #33 received at 25122 <at> debbugs.gnu.org (full text, mbox):

From: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 25122 <at> debbugs.gnu.org
Subject: Re: bug#25122: 24.5;
 function describe-variable hangs on large variables
Date: Sat, 11 Mar 2017 20:26:56 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>>           (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.

However it is fast, it is anyway better than the actual situation were e.g C-h v
load-history takes minutes in the best case to load the 1.8M help buffer.
With this code it takes around 1s.

> 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).

The code above run at the same speed with and without print-circle...

-- 
Thierry




This bug report was last modified 8 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.