Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: improve performance of `indent` rule #8905

merged 7 commits into from Jul 12, 2017

Avoid unnecessary tree deletions and reads

  • Loading branch information...
not-an-aardvark committed Jul 10, 2017
commit 102c364cb97f866e8017105b44ca76968c61e1cc
@@ -150,12 +150,12 @@ class BinarySearchTree {

* Finds the entry with the largest key greater than or equal to the provided key
* Finds the entry with the largest key greater than the provided key
* @param {number} key The provided key
* @returns {{key: number, value: *}|null} The found entry, or null if no such entry exists
findGe(key) {
const iterator =;
findGt(key) {
const iterator =;

return iterator && { key: iterator.key, value: iterator.value };
@@ -385,11 +385,11 @@ class OffsetStorage {
const fromTokenDescriptor = fromTokenIsInRange && this._getOffsetDescriptor(fromToken);

// First, remove any existing nodes in the range from the tree.
let existingNodeInRange = this._tree.findGe(range[0]);
let existingNodeInRange = this._tree.findGt(range[0]);

while (existingNodeInRange && existingNodeInRange.key < range[1]) {
existingNodeInRange = this._tree.findGe(range[0]);
existingNodeInRange = this._tree.findGt(range[0]);

// Insert a new node into the tree for this range
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.