Commit aa2f2a3
perf: replace synchronous file check with async in native worker
Optimized `getNativeBinaryPath` to use `fs.promises.access` instead of `fs.existsSync`. This prevents blocking the event loop during extension initialization, improving responsiveness, especially on slow file systems.
Updated `isNativeAvailable` and `createNativeDatabaseConnection` to be async, and propagated changes to `src/workerFactory.ts`.
Benchmark results (10k iterations):
- Sync: ~53ms total
- Async: ~1030ms total
While async has higher overhead, it is non-blocking, which is preferred for UI responsiveness. The impact on single execution is negligible (<0.1ms).
Co-authored-by: zknpr <96851588+zknpr@users.noreply.github.com>1 parent e9c4c24 commit aa2f2a3
2 files changed
Lines changed: 10 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
| 92 | + | |
92 | 93 | | |
| 94 | + | |
| 95 | + | |
93 | 96 | | |
94 | | - | |
95 | | - | |
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| |||
369 | 370 | | |
370 | 371 | | |
371 | 372 | | |
372 | | - | |
373 | | - | |
| 373 | + | |
| 374 | + | |
374 | 375 | | |
375 | 376 | | |
376 | 377 | | |
| |||
387 | 388 | | |
388 | 389 | | |
389 | 390 | | |
390 | | - | |
| 391 | + | |
391 | 392 | | |
392 | 393 | | |
393 | 394 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
0 commit comments