Why I quit Atom and went back to Sublime

Tom Golden
Tom Golden

But first, Google Chrome

It is still just about the quickest browser too, as of right now...

Wait a second... Why is my computer lagging? I've only got Atom and Chrome open.

(opens system dashboard)

Chrome using 2.5GB of RAM

UN. I. DEAL. My RAM is getting wrecked. Chrome's using 2.5GB, Slack's using 1.5GB and Atom's using 3GB.

That's 7GB. For 3 programs. I mean, technically you can make web browsers, Slack clients and text editors that work in the terminal. And yet, these three apps need 7GB between them?

1969 Apollo 11 Memory:
  AGC Total RAM:
    1 kiloword = 1,024 * word = 1,024 * 16 bits = 16,384 bits.

2018 Slack Memory:
  Slack Approx RAM Usage:
    1.5GB = 1,500,000,000 bytes = 1,500,000,000 * 8 bits = 12,000,000,000 bits.

Number of spaceships needed to run Slack's desktop app:
  ceil(12,000,000,000 / 16,384) = 732,422 spaceships

(For more desktop Slack tips, see this article: https://malloc.fi/weird-tip-saves-slack-ram)

Electron

I guess I can understand why Chrome uses all this RAM, but why do Slack or Atom need that much?

Both Atom and Slack's desktop app are built with Electron, made by the folks at Github.

Electron is a Chrome window with some native system access, similar in concept to Apache Cordova. That means that a project uses a single code source and then can work on Windows, Mac and Linux. Ergo less platform-specific bugs and faster development. D.R.Y. af.

However, it has 2 main problems.

  1. It uses a lot of memory, as Chrome uses a lot of memory.
  2. It has a slow startup time, as Chrome has a slow startup time.

The random delays while it tries to find some memory, and the startup time often stop me from using them for quick tasks.

When I visited Github's office in San Francisco in 2017, I was surprised to learn that the Atom team (Atom is also made by Github) was only 4 developers.

Running a web browser to run a text editor is surely overkill.

It's not just Atom either. Many web developer tools use Electron as you need only be a web developer to make them. They include:

  • Atom
  • Visual Studio Code
  • Hyper (Terminal)
  • Postman (for HTTP requests)
  • MongoDB Compass
  • many more...

Atom is slow at basic text-editor things

The following numbers are from this Github repo. There are more tests and results on that page.

File 1:

hello.c

include <stdio.h>

int main()
{
    printf("Hello, world!\n");
}
Editor RAM used (kB)
vim 5,336
emacs -nw 17,060
sublime 45,800
atom 250,404
vscode 339,512

File 2:

test.xml (5.8MB XML File)

Editor RAM used (kB) RAM used (no highlighting) (kB)
vim 11,952 11,824
emacs -nw 23,216 21,320
sublime 64,608 63,800
vscode 391,496 383,440
atom n/a* 825,232
Editor Highlight test time
sublime 5s
emacs -nw 8s
vim 10s
vscode 28s
atom 1m 22s
Editor Find and replace time
vim 4.6s
sublime 6s
emacs -nw 9.7s
vscode 1m 12s
atom over 10m

*Atom won't highlight large files by default.

Wow. Sublime is fast.

Who knew? It can even open a 3GB file.

Not even command line editors emacs, vim or even nano could open it, yet Sublime managed it in a not completely unreasonable 75 seconds, and even has a cute progress bar. Awwh.

Isn't Sublime the one with the please buy me popup?

Yes. But you could actually buy it. I think we're programmed to ignore that popup from the WinRAR era...

It costs $80. For that, you get no more popups, get access to the latest developer builds, and the option to suggest new features.

Personally, $80 to make you a more efficient developer for years is a price worth paying, and helps to guarantee some level of product support.

...but Sublime Text is ugly...

True... but that's just the default theme.

I'm using the delightful "Monokai Pro" theme and color scheme (check it out here) and it has been getting a lot of jealous looks from my Atom-equipped colleagues. It's 10 EUR.

Other options include:

Sublime isn't quite perfect

  • You can't do basic file renaming, deleting and moving in the tree-view without the extension SideBarEnhancements
  • ~~Atom and VS Code work much nicer with version control, like Git~~
    (Update 2019) It's got it now :D
  • If you don't like something, you can't just hack some JS & CSS together like you can in Atom
  • Sublime's documentation is very not good
  • The directory recursive find and replace is either very restrictive with how to find the files with glob search, and the results screen is basic

The find and replace UI definitely needs work – but it is a lot faster than other editors, and in front-end, where languages are often not friendly to IDE functionality, find and replace is typically the most effective way of finding where something is coming from.

There really aren't many multi-platform GUI alternatives to Electron-based editors besides Sublime Text, but one that may end up veing popular xi-editor, which is open-source and written in Rust 😄


Reactive type-safe persistence

A little idea I had

Is it worth it to precompile your TypeScript Node.js code?

Benchmarks included for ts-node, tsc, webpack and rollup.