My IDE was too heavy, so I moved to Emacs

Author | Renato Athaydes

Translator | Sambodhi

Planning | Chu Xingjuan

An IDE (Integrated Development Environment) is a great tool that can make a developer’s life easier. I can’t even imagine what my job would be like without them.

But they don’t help us for nothing, and I’m suffering the consequences. I’ve been running my favorite IDE, Jetbrains’ IntelliJ IDEA Community Edition, on my underperforming MacBook Air circa 2019, and the whole experience has never been pleasant.

In this post, I want to ask the question: does an IDE really need to be so heavy that we could barely use it on a thousand dollar laptop a few years ago?

my problem

Screenshot using IntelliJ 2022.3

IntelliJ is such an excellent product that for professional development, I wouldn’t even consider switching to anything else. So, in this case, having the best laptop with the best tools should be a priority. On my top-of-the-line Mac M1 with 64GB of RAM and 10 CPU cores, everything feels light and smooth (well, almost everything… but running Kubernetes with a few Docker containers on it, the Mac M1 actually runs a bit doesn’t move!), so I don’t have any problems at work.

But when I want to work on a hobby project at home, I try to keep work and personal affairs strictly separate in order not to mix them up, and I’d rather go with my less powerful laptop at home.

The problem was that after only an hour or so of writing code and running tests in IntelliJ, the laptop was getting very hot. The fan noise got louder and louder, and finally got really annoying.

That’s not to mention the fact that the process can take a full minute, if not longer, when you’re “indexing” the content with barely any IDE functionality available…and that’s taking quite a while After that, just scan what you want to index!

I also have a Dell XPS 13 running Linux with a pretty decent config, but it’s the same thing, and the fans are noisier.

I can watch HD videos, listen to music, surf the web, and many other things with no problem…but obviously, writing code on anything that isn’t top-of-the-line is too much to ask.

The problem has nothing to do with the language stack I’m using. For example, I ran into more or less the same problem in Java, Groovy, and Dart (those are the programming languages ​​I’ve written the most lately). I also noticed that it was significantly worse in my projects using Kotlin and Java. Therefore, the problem does not appear to be related to a particular language or plugin.

While it hurts to say this, as a big fan of JetBrains and its tools, IntelliJ seems to have become too heavy to run properly on an early 2020 laptop, which isn’t very high-end.

I’ve been reporting issues to Jetbrains lately and at the last time they told me to turn off some plugins because there’s usually a rogue plugin causing the problem…which is true in the sense that since I’ve disabled I’m not quite Plugins of concern (WASM, Scala, Makefile, Clojure-Kit, JMH, Gradianto), the problem is indeed less obvious…but it definitely still exists.

IntelliJ alternatives

Jetbrains is working on Fleet, a new, lighter editor from JetBrains, and while it looks promising (it’s beautiful, thoughtful, and sleek), it still doesn’t feel light enough on my laptop… …it uses the same backend as IntelliJ after all, and that might be the problem (though that’s a big plus, too, since most of IntelliJ’s cool features live in Fleet too)…

I’ll probably move to it eventually, but given that it still has some pretty serious issues (which, naturally, is still in beta), it’s probably going to be a while before it’s ready for use.

When I used Eclipse ten years ago, it was a decent IDE, but unfortunately, it has become (and I did try it out recently!) rather user-unfriendly. I don’t want to offend anyone who loves it, but I wouldn’t consider revisiting this tool now. Not to mention, it has very poor support for most non-JVM languages, especially newer ones, since it has fallen out of favor for quite some time (it was once the IDE of choice for business-minded language designers).

Unfortunately for me, Vim is a tool I never thought to use. I know of several new and interesting IDE projects based on VIM, such as neovim, which makes it an attractive choice given its wide adoption. But I stumbled upon myself firmly on the side of Emacs in the old editor wars, as we shall see. I thought, one day, I might hop over to the other side to see it, but that day isn’t coming anytime soon.

Some people may ask: why not VS Code? Well, I actually have it installed, but I can’t bring myself to use it. Its keyboard shortcuts are not ergonomic in my opinion (and I can’t be bothered to customize it, for reasons that follow), it’s still heavy, Electron-based, and compared to other alternatives, when using I When it comes to languages, I find it very slow. I admit that VS Code looks good, and I know it’s the most popular editor out there, but it just doesn’t work for me. If you think it’s good enough, that’s fine too…but I definitely need something else.

Emacs to the rescue? !

That’s why I’m currently trying to get back into Emacs.

In case you don’t know Emacs, it’s a text editor as legendary as Vim, but it can do a lot more. It’s likely been around longer than you’ve been alive (certainly longer than me), and it’s still evolving!

It is part of the GNU project, arguably one of the most successful examples of early free and open source software.

Emacs is very lightweight compared to other software I’ve tried (funny that when it was first created it was considered a heavyweight software…how things have changed)! Some recent developments have brought advanced IDE features to most editors (I’m talking LSP, of course), and today, Emacs is a very capable IDE.

It does require an initial investment from anyone who has never tried it, as most of the things you expect from a modern editor either have to be manually configured, or are built in, but work in a completely different way. You’ll also need to know a little bit about Lisp (Emacs is built on its own Lisp dialect, elisp), but that’s actually part of the fun if you’re the kind of person who even considers something like Emacs as hackable.

I’ve noticed that there are more “out of the box” Emacs distributions, such as Spacemacs and Doom Emacs, which are more comfortable for those who want a modern editor without having to manually configure everything.

For a few years I’ve managed to configure Emacs with the most basic modern shortcuts that work in most other post-90s applications (like Cmd+S to save, Ctrl+Tab to switch buffers, etc. ). And it has great support for all the languages ​​I like to use (Java, Go, C, Rust, Dart, Groovy, Common Lisp and even Zig), including autocompletion, inline documentation, code navigation (go to definition, find implementation , back/forward to previous/next location, etc.), project-wide find for files/types/symbols, one-click test runner, and many other things that I consider to be essential features of an IDE.

However, my Emacs setup (feel free to take some snippets of it), still doesn’t quite match what I get out of the box in IntelliJ.

For example, in IntelliJ it’s easy to configure the version of Java you want to use, not only the compiler, but also the version of the Java standard API you want to stick with (important because Java is growing fast now), if you want It’s nice to be warned about using features that aren’t available on the version you’re using. But on Emacs, this is very problematic, because the way I use lsp-java, configuring the Java project needs to be done through Eclipse!

I realized this painfully when I was trying to change the code format and was forced to download Eclipse to change its default rules (which forcefully remove line breaks, make lines fill the entire configured maximum width, clutter code mess – I wonder who the hell thinks that’s a good default!).

Emacs also ignores some other important, more advanced warnings that IntelliJ would give. Like when you check for a logically impossible condition, it finds those egregious logic errors… and some mundane features that I haven’t bothered to discover how to do, like autofix warnings (I really Miss IntelliJ’s Alt+Enter) and inserting custom code snippets for things like System.out.println and public static void main (though it’s not hard at all to do this in Emacs, I’ll do it eventually!).

Emacs, on the other hand, has Magit, an amazing Git user interface that feels great. Org Mode brings magic to text files, and there’s even something like elfeed, which lets you read your favorite 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 is actually lighter, I actually took a screenshot of my laptop’s battery usage over a 24-hour period on a Saturday when I spent most of the day coding in IntelliJ, then the next day doing did the same thing, but using Emacs (working in the same project, doing very similar things).

Even though I spent less time programming on Sunday, I think the pictures make things pretty obvious.

In the case of Emacs, notice the smooth downward slope of the battery curve during a nice afternoon of coding.

In the case of using IntelliJ in the morning, you can see that after a full charge, the battery is “swallowed ferociously”, and the battery is back to normal usage mode before I go back to Emacs at night.

Not that I need this to know that IntelliJ is really power hungry! I know because the laptop keeps visibly slowing down while I’m using it. Experiences like workspace switching animations have become terribly bad.

While you can see in the screenshot above that I can pretty much stay on Emacs all day on a single charge, with IntelliJ it only took me half a morning before I had to plug in the charger.

My main concern, however, is that the fans are too loud, and while trying to keep the CPU cool, the keyboard gets too hot and uncomfortable to the touch. These factors combined make it nearly impossible for me to continue using IntelliJ on my tiny laptop, or at least make me feel really uncomfortable.

final thoughts

I’ve wanted to write an article on this subject for a long time. I’m afraid the results might not be very illuminating. But I still think what I said above needs to be said.

Emacs is much lighter than any modern IDE, while still having all the great features. I hope JetBrains hears my heart, takes it to heart and does something about it! Maybe, Fleet is the solution? !

Emacs is great, but it’s basically the work of volunteers working on it, so a lot of things feel really immature, undocumented, hard to use, etc. This pretty much goes to show that users only really get a perfect thing when one big company (or a few) backs a product. But for now, it seems like my best option for anything but professional use. I’m really glad it exists.

The text and pictures in this article are from InfoQ

loading.gif

This article is transferred from https://www.techug.com/post/my-ide-is-too-heavy-so-i-moved-to-emacsa8d9f3ac36315848a47a/
This site is only for collection, and the copyright belongs to the original author.