@@ -9,19 +9,13 @@ import assert from "assert";
99import * as vscode from "vscode" ;
1010import { endToEndTestSetup } from "../endToEndTestSetup" ;
1111
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-
2112const textBasedThreshold = 100 ;
2213const parseTreeThreshold = 500 ;
2314const surroundingPairThreshold = 25000 ;
2415
16+ const content = generateTestData ( ) ;
17+ const numLines = content . split ( "\n" ) . length ;
18+
2519suite ( `Performance: ${ numLines } lines JSON` , async function ( ) {
2620 endToEndTestSetup ( this ) ;
2721
@@ -128,3 +122,13 @@ async function testPerformance(threshold: number, action: ActionDescriptor) {
128122 `Duration ${ duration } ms exceeds threshold ${ threshold } ms` ,
129123 ) ;
130124}
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