From: Arthur Miller <arthur.miller@live.com>
To: emacs-devel@gnu.org
Subject: Which is faster: narrow-to-region or delete-region?
Date: Tue, 21 Sep 2021 22:10:09 +0200 [thread overview]
Message-ID: <AM9PR09MB49771FFB125823ED820AF13596A19@AM9PR09MB4977.eurprd09.prod.outlook.com> (raw)
I have a DEFUN in the middle of a temporary buffer; which is faster to use to
eliminate the rest of the code from the calculations for font lock:
(narrow-to-region defun-begin defun-end)
or
(delete-region (point-min) defun-begin) +
(delete-region defun-end (point-max))
I appreciate if I can get A or B answer so I don't have to benchmark, if it even
matters for the speed?
I have tried both and notice no differences. Looking at the code it seems that
narrow-to-region is faster, but I am not familiar with all the C calls the
respective function does, so hard for me to tell. The feel say narrow-to-region.
next reply other threads:[~2021-09-21 20:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-21 20:10 Arthur Miller [this message]
2021-09-22 5:51 ` Which is faster: narrow-to-region or delete-region? Eli Zaretskii
2021-09-22 7:00 ` Arthur Miller
2021-09-22 7:41 ` Eli Zaretskii
2021-09-22 8:53 ` Arthur Miller
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=AM9PR09MB49771FFB125823ED820AF13596A19@AM9PR09MB4977.eurprd09.prod.outlook.com \
--to=arthur.miller@live.com \
--cc=emacs-devel@gnu.org \
/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).