Improving the performance of Emacs’s Display Engine?
I came across an interesting thread on the GNU Emacs developer mailing list about an obscure variable called
redisplay-dont-pause and I figured I’d talk about it.
So, currently, if Emacs is busy redrawing the screen any input event (keyboard, mouse) will halt the redrawing and abort to handle the input event. The obvious benefit here is that the user will get a smoother typing experience, especially on older machines where display updates were slow. Nowadays, though, you could argue that this is an unnecessary and very conservative setting as it will cause screen tearing.
redisplay-dont-pause, when set to
t, will cause Emacs to fully redraw the display before it processes queued input events. This may have slight performance implications if you’re aggressively mouse scrolling a document or rely on your keyboard’s auto repeat feature. For most of us, myself included, it’s probably a no-brainer to switch it on.
Add this to your .emacs file to enable this functionality:
(setq redisplay-dont-pause t)