Major Changes in 1.3.0 Stable

Startup speed improvements

One of the team focuses has been improving performance, and we’re happy to report that we’ve been making great progress in the startup department. All in, these changes contribute to a 20% - 30% speedup depending on how many packages you have installed. We’ll go into more depth in another post, but if you’re interested, check out the pull requests.

Marker (find and replace!) speed improvements

Along the performance improvement theme, we’ve been focusing on improving the data structures related to markers. Markers are pretty core to Atom—they are the underpinnings for cursors, selections, the autocomplete suggestion box, and find result markers. Making them fast will improve performance for all of these cases, especially when there are tons of markers defined.

The original B+ tree index we blogged about earlier this year has now been replaced with a new data structure based on a randomized variant of balanced binary trees known as a treap. In addition to using a clearer, more efficient algorithm, we’ve also dropped the index to C++ for maximal performance and minimal impact on the v8 heap. Treaps are proving to be a useful approach for indexing state that tracks the contents of buffers, and we’re currently in the process of converting to a similar data structure to more efficiently track the spatial relationship between screen coordinates and buffer coordinates in the presence of transformations such as hard tab expansion, folds, and soft wraps.

Marker Layers

Just as important as algorithmic improvements, we’ve also introduced a new API construct called marker layers. We found firing creation events to be a large source of overhead when creating tons of markers, but most of our creation handlers were only acting on a small subset of the total markers in the system. Marker layers make this explicit, allowing you to subscribe to events on a limited set of markers. With this change, we can limit the cost of creating markers and allow packages to selectively expose their markers to other packages, giving you the choice of whether you want your markers to be part of your API or just an implementation detail.

It’s worth noting that search result and selection markers are no longer available via the default marker layer. If you need access to search result markers, you can use the new service exposed by the find-and-replace package. Selections have their own editor-level APIs, so direct marker access shouldn’t be necessary. Talk to us if you disagree.

Updates to moving lines in the buffer

When Auto Indent option is checked, moving lines up and down will autoindent the moving line. See the pull request for more details.

Additionally, moving lines in the buffer now works with multiple cursors. A big shout out goes to @lpommers and @abe33 for their tenacity in getting this change in. Check out the the pull request to see all that went into it (86 comments spanning 3 months!).