emacs-devel
[Top][All Lists]
Advanced

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

Re: [RFC, experimental] save_{excursion,restriction}


From: Ivan Andrus
Subject: Re: [RFC, experimental] save_{excursion,restriction}
Date: Tue, 24 Jul 2012 08:31:14 +0200

On Jul 24, 2012, at 1:45 AM, Stefan Monnier wrote:

>> It's worth trying to redesign save-restriction and save-excursion to avoid
>> allocating Lisp data. I tried some hacks for save-excursion, and it's quite
>> surprising: initially, running (while t (scroll-up) (sit-for 0.05)) over
>> just loaded xdisp.c with font-lock enabled asks for 600 GCs, and with this
>> patch it's just 350.
> 
> save-restriction should be fairly rare (and if it's not, that's
> something we should fix), but for save-excursion I'm not that surprised.

Now I'm curious.  Why should save-restriction be rare?  I use it 4 times in my 
.emacs with widen–I assume there is no way around that.  I use it another 9 
times with narrow-to-region so that I can mangle the region and use point-min 
and point-max.  Would it be better to use markers in this case?  Or perhaps a 
temp buffer?

It's used it another 2 dozen times in packages that I maintain, I assume for 
roughly the same reasons.

-Ivan


reply via email to

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