Subject: Re: bug#36877: 25.3; uniquify renaway uniquify-managed list

From: David Biesack <[email-masked]>
Date: Fri, 9 Aug 2019 15:58:22 +0000

Debugger entered: ("Adding duplicate to uniquify list! (bug-36877)" [cl-struct-uniquify-item "index.html" "/Users/david.biesack/dev/developer.apiture.com/_site/docs/apis/sample" #<buffer index.html<docs/apis/sample>> "index.html<docs/apis/sample>"])
  (progn (debug nil "Adding duplicate to uniquify list! (bug-36877)" item) (advice-remove (quote uniquify-rationalize) (function bug-36877-debug-fix-list-dups)))
  (if (gethash buf bug-36877-dup-table) (progn (debug nil "Adding duplicate to uniquify list! (bug-36877)" item) (advice-remove (quote uniquify-rationalize) (function bug-36877-debug-fix-list-dups))) (puthash buf item bug-36877-dup-table))
  (let ((buf (progn nil (or (and (memq (aref item 0) cl-struct-uniquify-item-tags)) (signal (quote wrong-type-argument) (list (quote uniquify-item) item))) (aref item 3)))) (if (gethash buf bug-36877-dup-table) (progn (debug nil "Adding duplicate to uniquify list! (bug-36877)" item) (advice-remove (quote uniquify-rationalize) (function bug-36877-debug-fix-list-dups))) (puthash buf item bug-36877-dup-table)))
  (while --dolist-tail-- (setq item (car --dolist-tail--)) (let ((buf (progn nil (or (and (memq ... cl-struct-uniquify-item-tags)) (signal (quote wrong-type-argument) (list ... item))) (aref item 3)))) (if (gethash buf bug-36877-dup-table) (progn (debug nil "Adding duplicate to uniquify list! (bug-36877)" item) (advice-remove (quote uniquify-rationalize) (function bug-36877-debug-fix-list-dups))) (puthash buf item bug-36877-dup-table))) (setq --dolist-tail-- (cdr --dolist-tail--)))
  (let ((--dolist-tail-- fix-list) item) (while --dolist-tail-- (setq item (car --dolist-tail--)) (let ((buf (progn nil (or (and ...) (signal ... ...)) (aref item 3)))) (if (gethash buf bug-36877-dup-table) (progn (debug nil "Adding duplicate to uniquify list! (bug-36877)" item) (advice-remove (quote uniquify-rationalize) (function bug-36877-debug-fix-list-dups))) (puthash buf item bug-36877-dup-table))) (setq --dolist-tail-- (cdr --dolist-tail--))))
  uniquify-rationalize-file-buffer-names("index.html" "/Users/david.biesack/dev/developer.apiture.com/_site/docs/apis/workflow/v0.13.0/" #<buffer index.html>)
  uniquify--create-file-buffer-advice(#[257 "\301!\211\302\230\203\f

David Biesack | Vice President, API Platforms
[email-masked] | @davidbiesack <https://twitter.com/davidbiesack>

On 8/8/19, 8:47 PM, "Noam Postavsky" <[email-masked]> wrote:

    David Biesack <[email-masked]> writes:

    > The list uniquified-managed sometimes starts to grow in an unmanaged manner (I suspect exponentially) after running
    > Emacs for a few days. My work involves heavily editing many files named "openapi.yaml" in about 20 different
    > directories, often switching git branches so I need to revisit (M-x revert-buffer) these files a lot.
    >
    > After a few days, I noticed opening new openapi.yaml files started to slow down dramatically - there would be several
    > seconds of delay, then tens of seconds. I narrowed this to uniquify. In my buffers, the local variable
    > uniquified-managed is more than 100,000 items long, with many duplicate items.

    Looks like the only place where uniquified-managed is set to non-nil is
    by uniquify-rationalize, so could you run with the advice below and post
    the backtrace you get with it?

        (defconst bug-36877-dup-table (make-hash-table :test 'eq))
        (defun bug-36877-debug-fix-list-dups (fix-list)
          (clrhash bug-36877-dup-table)
          (dolist (item fix-list)
            (let ((buf (uniquify-item-buffer item)))
              (if (gethash buf bug-36877-dup-table)
                  (progn (debug nil "Adding duplicate to uniquify list!" item)
                         ;; Just once.
                         (advice-remove 'uniquify-rationalize
                                        #'bug-36877-debug-fix-list-dups))
                (puthash buf item bug-36877-dup-table)))))
        (advice-add 'uniquify-rationalize :before #'bug-36877-debug-fix-list-dups)

Disclaimer: The information in this message may be proprietary and/or confidential, and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify Apiture immediately by replying to this message and deleting it from your computer.