chore: fix benchmark contextual testing and biome config

Swadhin Biswas committed 7 months ago
d39705a
1 parent be05999
commit d39705a
2 files changed
+7 -14
▼opengrammar/backend/bench.ts
+4-4
75
75
76
76
// Warm up (first run compiles regexes, loads dictionary, etc.)
77
77
console.log('Warming up...');
78
-RuleBasedAnalyzer.analyze('This is a warm up sentence with gonna and buyed.');
78
+RuleBasedAnalyzer.analyze('This is a warm up sentence with gonna and buyed.', { writingContext: 'general' });
79
79
console.log('Warm-up complete.\n');
80
80
81
81
for (const wordCount of sizes) {
89
89
90
90
for (let run = 0; run < 3; run++) {
91
91
const start = performance.now();
92
- const result = RuleBasedAnalyzer.analyze(text);
92
+ const result = RuleBasedAnalyzer.analyze(text, { writingContext: 'general' });
93
93
const elapsed = performance.now() - start;
94
94
times.push(elapsed);
95
95
issues = result.length;
159
159
console.log(` Regex Rules: ${formatMs(rulesTime)}`);
160
160
161
161
// 4. Deduplication (estimate)
162
-const allIssues = RuleBasedAnalyzer.analyze(bigText);
162
+const allIssues = RuleBasedAnalyzer.analyze(bigText, { writingContext: 'general' });
163
163
const dedupStart = performance.now();
164
164
// Re-run to measure dedup overhead
165
-RuleBasedAnalyzer.analyze(bigText);
165
+RuleBasedAnalyzer.analyze(bigText, { writingContext: 'general' });
166
166
const totalTime = performance.now() - dedupStart;
167
167
const dedupEstimate = totalTime - rulesTime - spellTime;
168
168
console.log(` Dedup + Other: ${formatMs(Math.max(0, dedupEstimate))}`);
169
169
▼opengrammar/biome.json
+3-10
3
3
"vcs": {
4
4
"enabled": false,
5
5
"clientKind": "git",
6
- "useIgnoreFile": false
6
+ "useIgnoreFile": true
7
7
},
8
8
"files": {
9
- "ignoreUnknown": true,
10
- "ignore": [
11
- "backend/dist",
12
- "extension/dist",
13
- "backend/node_modules",
14
- "extension/node_modules"
15
- ]
9
+ "ignoreUnknown": true
16
10
},
17
11
"formatter": {
18
12
"enabled": true,
34
28
"suspicious": {
35
29
"noExplicitAny": "off",
36
30
"noEmptyBlockStatements": "off",
37
- "noConsole": "off",
38
- "noConsoleLog": "off"
31
+ "noConsole": "off"
39
32
}
40
33
}
41
34
},
42
35