@@ -9,19 +9,13 @@ import assert from "assert";
9
9
import * as vscode from "vscode" ;
10
10
import { endToEndTestSetup } from "../endToEndTestSetup" ;
11
11
12
- const value = Object . fromEntries (
13
- new Array ( 100 ) . fill ( "" ) . map ( ( _ , i ) => [ i . toString ( ) , "value" ] ) ,
14
- ) ;
15
- const obj = Object . fromEntries (
16
- new Array ( 100 ) . fill ( "" ) . map ( ( _ , i ) => [ i . toString ( ) , value ] ) ,
17
- ) ;
18
- const content = JSON . stringify ( obj , null , 2 ) ;
19
- const numLines = content . split ( "\n" ) . length ;
20
-
21
12
const textBasedThreshold = 100 ;
22
13
const parseTreeThreshold = 500 ;
23
14
const surroundingPairThreshold = 25000 ;
24
15
16
+ const content = generateTestData ( ) ;
17
+ const numLines = content . split ( "\n" ) . length ;
18
+
25
19
suite ( `Performance: ${ numLines } lines JSON` , async function ( ) {
26
20
endToEndTestSetup ( this ) ;
27
21
@@ -128,3 +122,13 @@ async function testPerformance(threshold: number, action: ActionDescriptor) {
128
122
`Duration ${ duration } ms exceeds threshold ${ threshold } ms` ,
129
123
) ;
130
124
}
125
+
126
+ function generateTestData ( ) {
127
+ const value = Object . fromEntries (
128
+ new Array ( 100 ) . fill ( "" ) . map ( ( _ , i ) => [ i . toString ( ) , "value" ] ) ,
129
+ ) ;
130
+ const obj = Object . fromEntries (
131
+ new Array ( 100 ) . fill ( "" ) . map ( ( _ , i ) => [ i . toString ( ) , value ] ) ,
132
+ ) ;
133
+ return JSON . stringify ( obj , null , 2 ) ;
134
+ }
0 commit comments