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

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

bug#62364: 28.2; savehist file becomes quadratic when used with kill-rin


From: Eli Zaretskii
Subject: bug#62364: 28.2; savehist file becomes quadratic when used with kill-ring and evil-yank-rectangle
Date: Thu, 23 Mar 2023 10:54:19 +0200

> Cc: app-emacs-dev@janestreet.com
> From: Aaron Zeng <azeng@janestreet.com>
> Date: Tue, 21 Mar 2023 17:30:40 -0400
> 
> 
> Serializing text properties on savehist variables can cause quadratic
> behavior due to large shared data structures.  The motivating scenario
> is with `kill-ring' added to `savehist-additional-variables', and
> `evil-mode' enabled.  `evil-yank-rectangle' copies a string and sets
> its `yank-handler' text property to a structure containing a list of
> every line of the copied string.  When `savehist-save' runs, this text
> property can get serialized linearly many times (depending on the
> other text properties in different substrings of the copied text), and
> the property is as long as the text itself, which results in a
> quadratic amount of data serialization.
> 
> For example:
> 
> 1. emacs -Q
> 2. Enable savehist-mode and add kill-ring to savehist-additional-variables
> 3. Enable evil-mode (I'm using Evil version evil-git-9584081cf)
> 4. Open a medium-size file with several hundred lines
> 5. Copy the whole file as a rectangle, by pressing C-v G $ y
> 6. M-x savehist-save
> 
> On an OCaml source file with about 400 lines, savehist-save took over
> 5 seconds and resulted in a >70MB savehist file.
> 
> A suggested patch is below.  For comparison, with the patch,
> savehist-save takes less than a second and results in a 160kB savehist
> file.

Lars, Stefan, any comments?  Are there any downsides to binding
print-circle to a non-nil value here?





reply via email to

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