Speeding Up Emacs Garbage Collection

Tyler Dodge over at Living the Dream Blog has a very interesting post on his research on Emacs garbage collection time. He discovered that a a simple parameter change could reduce garbage collection wall clock time by 50%.

The change has to do with the size of blocks allocated to hold cons cells. The TL;DR is that increasing the size improves locality and produces a significant decrease in run time for garbage collection. Take a look at the post for the details but the interesting thing is that the change itself is simply a change to a single parameter.

From what I can tell, the commit that Dodge describes is to his fork of the Emacs distribution but it’s certainly something that deserves consideration by the Emacs maintainers. To be sure, Dodge’s experiment was restricted to the macOS platform but it will probably apply to other platforms as well.

The post is fairly short and well worth spending a couple of minutes reading. It’s a reminder how a simple change can have profound effects.

This entry was posted in General and tagged . Bookmark the permalink.