-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Reduce the cost of regexp exclusions
Fix #1775
- Loading branch information
Showing
7 changed files
with
10,042 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,18 @@ | ||
import * as TextRange from './TextRange'; | ||
|
||
const { makeSortedMatchRangeArray } = TextRange.__testing__; | ||
|
||
describe('Util Text', () => { | ||
test('tests unionRanges', () => { | ||
const result1 = TextRange.unionRanges([]); | ||
expect(result1).toEqual([]); | ||
const result2 = TextRange.unionRanges([{ startPos: 0, endPos: 10 }]); | ||
expect(result2).toEqual([{ startPos: 0, endPos: 10 }]); | ||
const result3 = TextRange.unionRanges([ | ||
{ startPos: 0, endPos: 10 }, | ||
{ startPos: 0, endPos: 10 }, | ||
]); | ||
expect(result3).toEqual([{ startPos: 0, endPos: 10 }]); | ||
const result4 = TextRange.unionRanges([ | ||
{ startPos: 5, endPos: 15 }, | ||
{ startPos: 0, endPos: 10 }, | ||
]); | ||
expect(result4).toEqual([{ startPos: 0, endPos: 15 }]); | ||
const result5 = TextRange.unionRanges([ | ||
{ startPos: 11, endPos: 15 }, | ||
{ startPos: 0, endPos: 10 }, | ||
]); | ||
expect(result5).toEqual([ | ||
{ startPos: 0, endPos: 10 }, | ||
{ startPos: 11, endPos: 15 }, | ||
]); | ||
const result6 = TextRange.unionRanges([ | ||
{ startPos: 10, endPos: 15 }, | ||
{ startPos: 0, endPos: 10 }, | ||
]); | ||
expect(result6).toEqual([{ startPos: 0, endPos: 15 }]); | ||
test.each` | ||
ranges | expected | ||
${[]} | ${[]} | ||
${[{ startPos: 0, endPos: 10 }]} | ${[{ startPos: 0, endPos: 10 }]} | ||
${[{ startPos: 0, endPos: 10 }, { startPos: 0, endPos: 10 }]} | ${[{ startPos: 0, endPos: 10 }]} | ||
${[{ startPos: 5, endPos: 15 }, { startPos: 0, endPos: 10 }]} | ${[{ startPos: 0, endPos: 15 }]} | ||
${[{ startPos: 11, endPos: 15 }, { startPos: 0, endPos: 10 }]} | ${[{ startPos: 0, endPos: 10 }, { startPos: 11, endPos: 15 }]} | ||
${[{ startPos: 10, endPos: 15 }, { startPos: 0, endPos: 10 }]} | ${[{ startPos: 0, endPos: 15 }]} | ||
`('unionRanges $ranges', ({ ranges, expected }) => { | ||
const r = TextRange.unionRanges(ranges); | ||
expect(r).toEqual(makeSortedMatchRangeArray(expected)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Performance bug | ||
|
||
[Performance - took to long to spell check file - `utf_info.hxx` · Issue #1775 · streetsidesoftware/cspell](https://github.com/streetsidesoftware/cspell/issues/1775) | ||
|
||
## Info | ||
|
||
It took nearly 30 seconds to spell check a single file: | ||
[nuspell/utf_info.hxx at master · nuspell/nuspell](https://github.com/nuspell/nuspell/blob/master/external/hunspell/hunspell/utf_info.hxx) | ||
|
||
**Kind of Issue** | ||
|
||
- [X] runtime - command-line tools | ||
|
||
**Which Tool or library** | ||
|
||
- [X] cspell -- the command-line spelling tool | ||
- [X] cspell-lib -- library that does the actual spell checking. | ||
|
||
**Which Version** | ||
|
||
Version: 5.10.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"words": [ | ||
"nuspell" | ||
] | ||
} |
Oops, something went wrong.