December 27, 2016

Sublime Text vs Visual Studio Code vs Atom Performance Test (Dec 2016)

Speaking of text editor, I have been using Sublime Text for around 3 years, and I have no issues with it. I tried Atom one or two year ago and I was impressed by its active community (GitHub! I love GitHub). The UI especially intrigued me. The reason I sticked with Sublime Text was performance: Atom was slow, even after when Atom 1.0 was announced.

These days, I Googled “Sublime Text vs Atom 2016”, trying to see if Atom has significant improvement when I found Visual Studio Code. Visual Studio is also built using Web Technology like Atom, but reviewers said it is faster. So I want to do a test and find out their performance difference.

Editor Versions

Editor Version
Sublime Text 3 beta, build 3126
Atom 1.12.7
Visual Studio Code 1.8.1
TextEdit 1.12 (329)

Methodology

The hardware I tested on was a MacBook Pro 2016 13-inch with Touch Bar (with 2.9 GHz Intel Core i5 CPU and 8 GB 2133 MHz LPDDR3 RAM running macOS Sierra 10.12.2). All programs I could see had been closed. macOS’s stock TextEdit was used as a reference.

Launch Time

Each editor was launched from Dock by clicking the icon. I recorded the time between clicking the icon and the moment when first window was full loaded.

Window Open Time

Each editor was launched first with all windows closed afterwards. I would record the time between clicking the “New Window” from the menu in the Dock (or its equivalents) and the moment when first window was full loaded.

Files Open Time

Each editor was launched first with a window open. A file was dragged from Finder to its window. I recorded the time between the file being released and the moment when the file was full loaded.

Files Generating

Four files contained 10k, 100k, 1m, 10m lines were generated by the following Python script. The files’ sizes were 370KB, 3.7MB, 37MB and 370MB respectively.

template = '''

#include <iostream>

int main() {
    return 0;
}

/*
%s
*/
'''

string = 'abcdefghijklmnopqrstuvwxyz1234567890\n'

with open('test-10k.cpp', 'w') as f:
    f.write(template % (string * 10000,))

with open('test-100k.cpp', 'w') as f:
    f.write(template % (string * 100000,))

with open('test-1m.cpp', 'w') as f:
    f.write(template % (string * 1000000,))

with open('test-10m.cpp', 'w') as f:
    f.write(template % (string * 10000000,))

Files Open Time

Each editor was launched first with a file loaded. I used Activity Monitor to add up memory used by all its processes. The file used was the 370KB one in “Files Open Time” tests.

Result

Launch Time

Launch Time Chart

  • TextEdit does not open a edit window when launching, instead it shows a file picker window.

Window Open Time

Window Open Time Chart

Notes:

  • TextEdit has a pop-up animation when opening a window, which slows it down a little bit.

Files Open Time

Files Open Time Chart

Notes:

  • Atom could not open “1m lines” file and reported “crashed” after around 40 seconds.
  • Visual Studio Code did not allow me to open “10m lines” file saying “very large”.
  • Atom could not keep syntax highlighting when openning the “100k lines” file.
  • Visual Studio Code could not keep syntax highlighting when openning the “1m lines” file.
  • TextEdit does not have syntax highlighting feature.
  • TextEdit has a pop-up animation when opening a file, which slows it down a little bit.

Memory Usage

Memory Usage Chart

Conclusion

Atom and Visual Studio Code perform significantly worse compared to Sublime Text and TextEdit: launching and Opening windows are seconds slower which it is noticeable and they occupied much more RAM.

Visual Studio Code has advantages over Atom in opening files and RAM usage. It could handle larger files and handle it faster than Atom. When I tested the 3.7MB file, it opened it within 1 second while Atom took more than 2 seconds.

Sublime Text is still the speedy king, Visual Studio Code second and Atom is the last.

Extra words: I start to use Visual Studio Code to replace Sublime Text from this month, it seems more fun.

Extra words (2): I switched back to Sublime Text again after a few weeks: with hundreds of file opening, the speed difference is indeed sensible.

© xinhong 2017