emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Which is faster: narrow-to-region or delete-region?


From: Arthur Miller
Subject: Which is faster: narrow-to-region or delete-region?
Date: Tue, 21 Sep 2021 22:10:09 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]