Improving Emacs Performance
My Emacs config has grown considerably over
the years. I love finding new packages to improve my workflow, and
use-package together make packages really easy to install.
But this is bad news if you want a fast and productive editing experience. A few weeks ago, some dastardly sluggishness when editing Rust code forced me to finally sit down and address the problem. Here are some Mrcnski Tips I’ve collected from the process.
- It helps a lot to cut down on frills you don’t need. Disable things like syntax checking as you type or make them run on save instead.
- Get rid of large, hefty packages like
helmand use simpler ones, like
- Prefer built-in packages like
flymaketo third-party ones like
- Increase the GC threshold and set it to run when you tab out or go idle:
- I disabled my fancy modeline and
show-parensand my experience is smoother. Try disabling one minor mode at a time and see how things feel with each change.
- Also, use
profiler-reportto profile runtime.
- There’s also
benchmark-initpackage for profiling startup, but I don’t much care about that.
As with all things, you will have to strike a balance between performance and functionality. I still get the occasional GC hiccup, and it bothers me some, but not enough to sacrifice the formidable 10x productivity increase I get from all my packages.