emacs-devel
[Top][All Lists]
Advanced

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

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


From: Eli Zaretskii
Subject: Re: Which is faster: narrow-to-region or delete-region?
Date: Wed, 22 Sep 2021 08:51:04 +0300

> From: Arthur Miller <arthur.miller@live.com>
> Date: Tue, 21 Sep 2021 22:10:09 +0200
> 
> 
> 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))

The narrow-to-region method must be much faster, since it only sets a
bunch of variables and does little else.  Moreover, it cannot trigger
GC, whereas delete-region method very well can.

> I have tried both and notice no differences.

Maybe in a very small buffer.



reply via email to

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