Commit 8c000cb
authored
## Summary
Eliminates dual bottlenecks in TypeScript/JavaScript file analysis that
caused 20-25 minute delays on large codebases.
Fixes #969
## Problem
The NodeJS provider had **two major bottlenecks**:
1. **Sleep bottleneck**: 2-second sleep before EACH file
- 582 files × 2s = 1,164 seconds (~19 minutes) of pure waiting
2. **Query bottleneck**: `GetAllDeclarations` called 18 times
- Once per 32-file batch instead of once total
- Each call queries the entire workspace for symbols (expensive
operation)
## Solution
Modified
`external-providers/generic-external-provider/pkg/server_configurations/nodejs/service_client.go`:
**Before:**
- Batch processing (32 files at a time)
- 2-second sleep before each `didOpen` notification
- `GetAllDeclarations` called after each batch (18 times total)
**After:**
- Open all files in single loop (no per-file sleep)
- Single 500ms sleep after all `didOpen` notifications sent
- Call `GetAllDeclarations` once after all files are indexed
- Simplified `didClose` loop
The single sleep after all files prevents the race condition (symbol
queries happening before LSP server finishes indexing) without the
massive overhead of sleeping before each file.
## Performance Results
**Test environment:** tackle2-ui (582 TypeScript files, 56 PatternFly
rules)
| Metric | Before | After | Improvement |
|--------|--------|-------|-------------|
| **Total time** | 20-25 minutes | **1m 43s** | **91% faster** |
| **Actual time** | 1200-1500s | **103 seconds** | **12x speedup** |
| **Sleep overhead** | 1,164s | 0.5s | 99.96% reduction |
| **Workspace queries** | 18 calls | 1 call | 94% reduction |
## Testing
- ✅ Output file generated successfully (213 KB, 2,982 lines)
- ✅ Violations detected correctly (PatternFly migration issues)
- ✅ No errors or warnings in execution
- ✅ Tested on both small and large TypeScript codebases
## Additional Notes
This fix is even better than the original proposal because it eliminates
both the sleep bottleneck AND the redundant workspace queries.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Optimized file processing flow for improved performance and
reliability by consolidating file operations into a streamlined
single-pass approach with coordinated resource management.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Signed-off-by: tsanders <tsanders@redhat.com>
1 parent 5d44057 commit 8c000cb
1 file changed
Lines changed: 22 additions & 27 deletions
File tree
- external-providers/generic-external-provider/pkg/server_configurations/nodejs
Lines changed: 22 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
224 | 210 | | |
225 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
226 | 215 | | |
227 | | - | |
228 | | - | |
229 | 216 | | |
230 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
231 | 226 | | |
232 | 227 | | |
233 | 228 | | |
234 | 229 | | |
235 | 230 | | |
236 | | - | |
237 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
238 | 234 | | |
239 | 235 | | |
240 | | - | |
241 | 236 | | |
242 | 237 | | |
243 | 238 | | |
| |||
0 commit comments