@@ -25,40 +25,40 @@ suite(`Performance: ${numLines} lines JSON`, async function () {
2525 }
2626 } ) ;
2727
28- const textBasedThreshold = 100 ;
29- const parseTreeThreshold = 500 ;
30- const surroundingPairThreshold = 30000 ;
28+ const textBasedThresholdMs = 100 ;
29+ const parseTreeThresholdMs = 500 ;
30+ const surroundingPairThresholdMs = 30000 ;
3131
3232 test (
3333 "Remove token" ,
34- asyncSafety ( ( ) => removeToken ( textBasedThreshold ) ) ,
34+ asyncSafety ( ( ) => removeToken ( textBasedThresholdMs ) ) ,
3535 ) ;
3636
3737 const fixtures : [ SimpleScopeTypeType | ScopeType , number ] [ ] = [
3838 // Text based
39- [ "character" , textBasedThreshold ] ,
40- [ "word" , textBasedThreshold ] ,
41- [ "token" , textBasedThreshold ] ,
42- [ "identifier" , textBasedThreshold ] ,
43- [ "line" , textBasedThreshold ] ,
44- [ "sentence" , textBasedThreshold ] ,
45- [ "paragraph" , textBasedThreshold ] ,
46- [ "document" , textBasedThreshold ] ,
47- [ "nonWhitespaceSequence" , textBasedThreshold ] ,
39+ [ "character" , textBasedThresholdMs ] ,
40+ [ "word" , textBasedThresholdMs ] ,
41+ [ "token" , textBasedThresholdMs ] ,
42+ [ "identifier" , textBasedThresholdMs ] ,
43+ [ "line" , textBasedThresholdMs ] ,
44+ [ "sentence" , textBasedThresholdMs ] ,
45+ [ "paragraph" , textBasedThresholdMs ] ,
46+ [ "document" , textBasedThresholdMs ] ,
47+ [ "nonWhitespaceSequence" , textBasedThresholdMs ] ,
4848 // Parse tree based
49- [ "string" , parseTreeThreshold ] ,
50- [ "map" , parseTreeThreshold ] ,
51- [ "collectionKey" , parseTreeThreshold ] ,
52- [ "value" , parseTreeThreshold ] ,
49+ [ "string" , parseTreeThresholdMs ] ,
50+ [ "map" , parseTreeThresholdMs ] ,
51+ [ "collectionKey" , parseTreeThresholdMs ] ,
52+ [ "value" , parseTreeThresholdMs ] ,
5353 // Text based, but utilizes surrounding pair
54- [ "boundedParagraph" , surroundingPairThreshold ] ,
55- [ "boundedNonWhitespaceSequence" , surroundingPairThreshold ] ,
56- [ "collectionItem" , surroundingPairThreshold ] ,
54+ [ "boundedParagraph" , surroundingPairThresholdMs ] ,
55+ [ "boundedNonWhitespaceSequence" , surroundingPairThresholdMs ] ,
56+ [ "collectionItem" , surroundingPairThresholdMs ] ,
5757 // Surrounding pair
58- [ { type : "surroundingPair" , delimiter : "any" } , surroundingPairThreshold ] ,
58+ [ { type : "surroundingPair" , delimiter : "any" } , surroundingPairThresholdMs ] ,
5959 [
6060 { type : "surroundingPair" , delimiter : "curlyBrackets" } ,
61- surroundingPairThreshold ,
61+ surroundingPairThresholdMs ,
6262 ] ,
6363 ] ;
6464
@@ -129,6 +129,14 @@ function getScopeTypeAndTitle(
129129 throw Error ( `Unexpected scope type: ${ scope . type } ` ) ;
130130}
131131
132+ /**
133+ * Generate a large JSON object with 100 keys, each with 100 values.
134+ * {
135+ * "0": { "0": "value", "1": "value", ... },
136+ * "1": { "0": "value", "1": "value", ... },
137+ * ...
138+ * }
139+ */
132140function generateTestData ( ) : string {
133141 const value = Object . fromEntries (
134142 new Array ( 100 ) . fill ( "" ) . map ( ( _ , i ) => [ i . toString ( ) , "value" ] ) ,
0 commit comments