Skip to content

Commit 556be56

Browse files
More refactoring
1 parent 0bee3b6 commit 556be56

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

packages/cursorless-vscode-e2e/src/suite/performance.vscode.test.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,13 @@ import assert from "assert";
99
import * as vscode from "vscode";
1010
import { 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-
2112
const textBasedThreshold = 100;
2213
const parseTreeThreshold = 500;
2314
const surroundingPairThreshold = 25000;
2415

16+
const content = generateTestData();
17+
const numLines = content.split("\n").length;
18+
2519
suite(`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

Comments
 (0)