unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Aaron Zeng <azeng@janestreet.com>,
	Lars Ingebrigtsen <larsi@gnus.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Cc: app-emacs-dev@janestreet.com, 62364@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	[thread overview]
Message-ID: <83355v6e6c.fsf@gnu.org> (raw)
In-Reply-To: <q7mpm91yepr.fsf@janestreet.com> (message from Aaron Zeng on Tue,  21 Mar 2023 17:30:40 -0400)

> 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	other threads:[~2023-03-23  8:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21 21:30 bug#62364: 28.2; savehist file becomes quadratic when used with kill-ring and evil-yank-rectangle Aaron Zeng
2023-03-23  8:54 ` Eli Zaretskii [this message]
2023-03-23 13:04   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-25 12:14     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83355v6e6c.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=62364@debbugs.gnu.org \
    --cc=app-emacs-dev@janestreet.com \
    --cc=azeng@janestreet.com \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).