From ea372c2e0cd26c3228df491dfd59eec72da271b8 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Wed, 6 Jun 2018 15:32:46 -0700 Subject: [PATCH] Remove toLowerCase calls from inner loops, fix #50904 --- src/vs/base/common/filters.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/vs/base/common/filters.ts b/src/vs/base/common/filters.ts index 4650340de90..5f052e2e02a 100644 --- a/src/vs/base/common/filters.ts +++ b/src/vs/base/common/filters.ts @@ -255,7 +255,8 @@ export function matchesCamelCase(word: string, camelCaseWord: string): IMatch[] let result: IMatch[] = null; let i = 0; - while (i < camelCaseWord.length && (result = _matchesCamelCase(word.toLowerCase(), camelCaseWord, 0, i)) === null) { + word = word.toLowerCase(); + while (i < camelCaseWord.length && (result = _matchesCamelCase(word, camelCaseWord, 0, i)) === null) { i = nextAnchor(camelCaseWord, i + 1); } @@ -275,7 +276,9 @@ export function matchesWords(word: string, target: string, contiguous: boolean = let result: IMatch[] = null; let i = 0; - while (i < target.length && (result = _matchesWords(word.toLowerCase(), target, 0, i, contiguous)) === null) { + word = word.toLowerCase(); + target = target.toLowerCase(); + while (i < target.length && (result = _matchesWords(word, target, 0, i, contiguous)) === null) { i = nextWord(target, i + 1); } @@ -287,7 +290,7 @@ function _matchesWords(word: string, target: string, i: number, j: number, conti return []; } else if (j === target.length) { return null; - } else if (word[i] !== target[j].toLowerCase()) { + } else if (word[i] !== target[j]) { return null; } else { let result: IMatch[] = null;