all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Which is faster: narrow-to-region or delete-region?
@ 2021-09-21 20:10 Arthur Miller
  2021-09-22  5:51 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Arthur Miller @ 2021-09-21 20:10 UTC (permalink / raw)
  To: emacs-devel


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.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-22  8:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-21 20:10 Which is faster: narrow-to-region or delete-region? Arthur Miller
2021-09-22  5:51 ` Eli Zaretskii
2021-09-22  7:00   ` Arthur Miller
2021-09-22  7:41     ` Eli Zaretskii
2021-09-22  8:53       ` Arthur Miller

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.