GNU bug report logs - #62364
28.2; savehist file becomes quadratic when used with kill-ring and evil-yank-rectangle

Previous Next

Package: emacs;

Reported by: Aaron Zeng <azeng <at> janestreet.com>

Date: Wed, 22 Mar 2023 02:06:01 UTC

Severity: normal

Found in version 28.2

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Aaron Zeng <azeng <at> janestreet.com>, Lars Ingebrigtsen <larsi <at> gnus.org>, Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: app-emacs-dev <at> janestreet.com, 62364 <at> debbugs.gnu.org
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 <at> janestreet.com
> From: Aaron Zeng <azeng <at> 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?




This bug report was last modified 2 years and 136 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.