unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: k.michal@zoho.com
Cc: 31888-done@debbugs.gnu.org
Subject: bug#31888: 27.0.50; Segmentation fault in replace-buffer-contents
Date: Sat, 23 Jun 2018 14:15:23 +0300	[thread overview]
Message-ID: <83bmc1vjn8.fsf@gnu.org> (raw)
In-Reply-To: <83602bq8hl.fsf@gnu.org> (message from Eli Zaretskii on Fri, 22 Jun 2018 16:03:02 +0300)

> Date: Fri, 22 Jun 2018 16:03:02 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 31888@debbugs.gnu.org
> 
> The command is still too slow (takes about 2.5 min for the above use
> case in my unoptimized build, about 30 sec of which is spent in
> compareseq).  I will try to look into speeding it up.

I could find only a minor speedup (about 10%), by slightly changing
buffer_chars_equal per suggestion in another bug report.

In this particular case, replacing the contents of dispnew.c with that
of contents.c takes 2018 deletions and 2781 insertions, each one of
these operations takes about 20 msec in the unoptimized build where I
timed them; the call to compareseq takes another 26 sec (expect the
times to be lower by a factor of 3 in an optimized build).  My
conclusion from various attempts to speed up the code was that most of
this time is taken by making small changes to buffer text, which
involves moving the gap, which in turn requires shuffling of buffer
text to and fro.  I don't see how can we speed that up if we stay with
the current idea of the function, and want to preserve text properties
and overlays as much as possible.

So I ended up inserting a few calls to maybe_quit into the inner loops
of the function, to allow users bail out of lengthy execution, and
warning about the potential slowness in the doc string.

I'm closing this bug; if someone has ideas for how to speed up the
function significantly, please reopen, or file a new bug.





  reply	other threads:[~2018-06-23 11:15 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 [this message]
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
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

  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=83bmc1vjn8.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=31888-done@debbugs.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 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).