all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 31888@debbugs.gnu.org, k.michal@zoho.com
Subject: bug#31888: 27.0.50; Segmentation fault in replace-buffer-contents
Date: Mon, 25 Jun 2018 16:55:59 +0100	[thread overview]
Message-ID: <87lgb2lv1s.fsf@gmail.com> (raw)
In-Reply-To: <83muvisyqv.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 25 Jun 2018 17:54:16 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: João Távora <joaotavora@gmail.com>
>> Cc: eliz@gnu.org,  k.michal@zoho.com
>> Date: Mon, 25 Jun 2018 11:49:58 +0100
>> 
>> I'm using this function in my Eglot package, but only because of its
>> ability to preserve markers, not text properties. And only one marker in
>> particular, the point marker.  So I wonder if sth like a
>> replace-buffer-contents-no-properties could be added: according to your
>> analysis it could be significantly faster.

> I doubt that, because keeping markers needs the same technique:
> deletions interspersed with insertions, where both deletions and
> insertions are as small as possible.

Thanks for explaining.  Without looking at the code, I would expect
performance to vary in proportion to the number of things to preserve
Thus, text properties, especially font-lock's, of which there are many
more than markers, probably weigh more.

> (You should only see the slowness if there are a lot of small
> differences scattered all over the buffers.  A few large differences
> close together should let the function's optimized algorithm to do a
> better job.)

Thanks again.  FWIW, here's why I need it: when asking the LSP server to
reformat the buffer (mostly reindent + whitespace here and there), some
servers answer with multiple small edits resulting in multiple
replace-buffer-contents calls.  For these cases, some speedup can
probably be attained by only calling replace-buffer-contents when the
affected region contains point.

Unfortunately, other servers (Python's, afaik) reply with a complete
slightly changed copy of a buffer, with short whitespace sequences added
or removed more or less uniformely throughout buffer.  These cases would
probably fall into the conditions you describe.  So maybe it could help
if replace-buffer-contents accepted only a subset of buffer markers that
need saving.

João






  reply	other threads:[~2018-06-25 15:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-17 13:12 bug#31888: 27.0.50; Segmentation fault in replace-buffer-contents Michał Kondraciuk
2018-06-18 21:50 ` bug#31888: Milan Stanojević
2018-06-22 13:03 ` bug#31888: 27.0.50; Segmentation fault in replace-buffer-contents Eli Zaretskii
2018-06-23 11:15   ` Eli Zaretskii
2018-06-25 10:49     ` João Távora
2018-06-25 14:54       ` Eli Zaretskii
2018-06-25 15:55         ` João Távora [this message]
2018-06-29 14:07         ` Eli Zaretskii
2018-06-29 14:51           ` Stefan Monnier
2018-06-29 15:23             ` Eli Zaretskii
2018-06-29 16:57               ` Stefan Monnier
2018-06-29 17:34                 ` Eli Zaretskii
2018-06-29 17:39                   ` Eli Zaretskii
2018-06-29 19:04                     ` João Távora
2018-06-29 19:09                       ` Eli Zaretskii
2018-06-30  8:33                         ` João Távora
2018-06-30 11:03                           ` Eli Zaretskii
2018-06-30 13:28                             ` João Távora
2018-06-29 20:40                   ` Stefan Monnier
2018-06-30  7:44                     ` Eli Zaretskii
2018-06-30 12:54                       ` Stefan Monnier
2018-06-30 13:51                         ` 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

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

  git send-email \
    --in-reply-to=87lgb2lv1s.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=31888@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=k.michal@zoho.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.