My IDE is too heavy so I moved to Emacs
IDEs (Integrated Development Environment) are great tools to make the lives of developers easier.
They help us in so many ways it’s almost impossible for me to imagine working without one.
But all the stuff they do to help us is not free, and lately, I’ve been suffering the consequences of that. I use an under-powered MacBook Air from around 2019 as my “hobby project”, personal laptop, and running the community edition of Jetbrains’ IntelliJ IDEA, my favourite IDE, on it has been an unpleasant experience.
In this post, I wanted to pose the question: do IDEs really need to be so heavy that we can barely use one on a laptop that cost a thousand dollars just a few years ago?
The problem
IntelliJ is a great product and I don’t even consider switching to anything else for professional development, where having the greatest laptop and the best tools possible should be a priority. On my top-of-the-line Mac M1 with 64GB of RAM and 10 CPU cores, everything feels lightweight and smooth (well, almost everything… running Kubernetes with a few Docker containers on it actually managed to make it sweat a little!), so I don’t have any issues with it at work.
But when I am at home and want to work on a hobby project, I prefer to use my less powerful laptops to avoid the possibility of mixing work with personal stuff, which I try to keep strictly separated.
The problem is that after just an hour or so writing code and running tests using IntelliJ, the laptop becomes unusably hot. The fans get louder and louder until it’s really annoying.
That’s not to mention the full minute, or more, when it decides to “index” stuff while you can’t use almost any IDE feature… and that’s after some considerable time just scanning for what to index!
I also have a Dell XPS 13 running Linux, with pretty decent specs and it’s the same story with it, the fans being even louder.
I can watch high definition videos, listen to music, browse the Internet and many other things without a problem… but apparently, writing code on anything other than top-of-the-line machines is too much to ask for.
The problem occurs, it seems, regardless of the language stack I am using. I experience more or less the same issues in Java, Groovy and Dart (which are the languages I’ve been writing the most lately), for example. I also noticed that on a project where I use Kotlin alongside Java, things are noticeably worse.
So, the problem doesn’t seem to be related to a particular language or plugin. As much as it hurts me to say this, as a fan of JetBrains and its tools, IntelliJ just seems to have become too heavy to run properly on a laptop that’s not at the very higher end of laptops in the early 2020’s.
I’ve been reporting issues to JetBrains lately, and in at last one occasion they’ve told me to turn off some plugins as usually there’s a rogue plugin causing issues… that was partly true because after I disabled some plugins I didn’t really care much about (WASM, Scala, Makefile, Clojure-Kit, JMH, Gradianto), the problem did become a bit less apparent… but it’s definitely still there.
IntelliJ alternatives
JetBrains is working on Fleet, a new, lighter editor from JetBrains, and while it seems very promising (it’s quite pretty, well thought out, modern), it still feels anything but light on my laptop… it uses the same backend as IntelliJ, after all, and that may be the problem (even though that’s also a huge plus, because most great features from IntelliJ are also present in Fleet)… I might switch to it, eventually, but it’s probably going to take some time before it’s ready for prime use given some pretty serious issues it still has (which is natural, being in beta for now).
Eclipse was a decent IDE when I used it almost a decade ago, but unfortunately, it became, and still seems to be (I did give it a try quite recently!) quite unfriendly to the user. I don’t want to offend anyone who likes it, but it’s not a tool I would consider going back to at this time… not to mention that support for most non-JVM languages, specially newer languages, is very poor as it has fallen out of favour for quite some time now (it was the go-to IDE for business-minded language designers at one point).
Vim, unfortunately for me, is a tool I’ve never wanted anything to do with! I am aware of several new and interesting IDE-initiatives based on VIM, like neovim, which make it an attractive option given its ubiquity. But I’ve found myself, by happenstance, firmly on the Emacs side of the old editor wars, as we’ll see. One day, I think, I might jump to have a look at the other side, but that day is not coming very soon.
Many of you may be asking: why not VS Code? Well, I actually have it installed but can’t get myself to use it. The shortcuts are just unergonomic in my opinion (and I can’t be bothered to customize it for the reasons coming next), it’s still pretty heavy, being based on Electron, and feels pretty slow when working with the languages I care about, compared to the alternatives. I acknowledge VS Code looks nice and am aware it’s the most popular editor today, but it’s just not for me. If you find it good enough, great for you… but I definitely need something else.
Emacs to the rescue?!
That’s why I am currently trying to get back to using Emacs.
In case you don’t know Emacs, it’s one of the legendary text editors, together with Vim, but it’s a lot more than that. It’s been around for longer than you’ve been alive, most likely (certainly older than me), but continues to evolve!
It’s part of the GNU project and arguably one of the most successful examples of early free and open source software.
Emacs is extremely light compared to anything else I’ve tried (funny, because at the time it was created it was considered a heavyweight… how things change)! With some recent developments that have brought advanced IDE features to most editors (I am talking about LSP, of course), Emacs is, today, a very capable IDE.
It does require an initial investment on the part of anyone who’s never tried it before, as most things you’ve come to expect from a modern editor either must be configured manually, or is built-in but works in a totally different way. You also need to understand a little bit about Lisp (Emacs is built on its own Lisp dialect called elisp) but that’s actually part of the fun if you’re the kind of person to even consider something so thoroughly hackable like Emacs.
I should note that there are more “ready out-of-the-box” Emacs distributions like Spacemacs and Doom Emacs that will feel more comfortable for those who want a modern editor without having to configure everything manually.
Over a couple of years, I have managed to configure Emacs with most basic modern shortcuts that work in most other applications post the 1990’s (small things like Cmd+S
to save, Ctrl+Tab
to switch buffers etc.) and with great support for all the languages I like to use (Java, Go, C, Rust, Dart, Groovy, Common Lisp and even Zig) including auto-completion, inlined documentation, code navigation (go to definition, find implementations, go back/forth to previous/next position etc.), project-wide find-file/type/symbol, one-click test runner and many other things I considered basic features for an IDE.
My Emacs setup (feel free to take some snippets from it), at least, is still not quite matching what I get out-of-the-box with IntelliJ though.
For example, it’s trivial in IntelliJ to configure which version of Java you want to use, including not just the compiler but the Java standard API version you want to stick with (as Java is moving very quick these days, this is important), and if you use a feature that’s not available on the version you’re using, it will warn you, which is really great… on Emacs, it’s quite problematic to do that because, the way I am using lsp-java, configuring the Java project needs to be done via Eclipse!
That became painfully clear to me when I tried to change the code formatter and was forced to download Eclipse just to change its default rules (it insists in removing line breaks by default to make lines fill the whole maximum width configured, making a total mess of the code - I really want to know who the hell thinks that’s a good default!?).
Emacs also misses some other important, more advanced warnings that IntelliJ will give, like those mind-blowing logical errors it picks up when you check for a condition that is logically impossible… and some mundane features that I have just not bothered yet to find out how to achieve, like auto-fixing warnings (I really miss IntelliJ’s Alt+Enter
) and inserting custom snippets for things like System.out.println
and public static void main
(though it’s not hard at all to do that in Emacs, I will get to that eventually!).
EDIT: I’ve found out how to get auto-fix suggestions with
Alt+Enter
!Add
(global-set-key (kbd "<M-return>") 'lsp-execute-code-action)
to your lsp-mode config.
On the other hand, Emacs has Magit, an amazing Git user interface that just feels right, Org Mode which gives text files magical powers, and even things like elfeed, which lets you read your favourite news (from RSS feeds and things like HackerNews and Reddit) without leaving your editor!
But is Emacs really lighter?
To answer the question of whether Emacs really is lighter, I actually took a screenshot of my laptop’s battery usage over 24 hours on a Saturday when I spent most of the day coding in emacs, and then did the same the next day, but using IntelliJ (working on the same project, doing very similar things).
Even though on Sunday I spent less time coding, I think the pictures make things pretty obvious:
Not that I needed this to know IntelliJ is just really battery power-hungry! I know because the laptop always gets noticeably slower while I am using it. Things like the workspace switching animation become junky as hell.
While you can see above that I was able to spend nearly all day on Emacs on a single battery charge, with IntelliJ I barely spent half the morning before I had to plug the recharger.
My main problem, however, is the loud fans trying to keep the CPU cool, while the keyboard becomes too warm to touch comfortably. Together, these make it almost impossible, or at least really uncomfortable for me to continue using IntelliJ on my small laptops.
Final thoughts
I have been wanting to write a post about this problem for quite some time. The result may not be very illuminating, I’m afraid. But I still think what I say above needs to be said.
The fact that Emacs is much lighter than any of the modern IDEs, while still having all the important features, shows that it doesn’t need to be this way.
I hope JetBrains hears my pledge and takes it to heart to do something about it! Perhaps, Fleet will be the solution?!
Emacs is great, but it’s basically a volunteer-based effort, and as such a lot of things feel really half-baked, undocumented, difficult to use and so on. It pretty much shows that only when you have a big company (or a few) behind a product you can really get something well polished. But for now, it seems to be the best alternative for me outside professional use. And I am really glad it exists.