Skip to content

Commit b0f79fd

Browse files
feat: 2x faster scanning, interactive search, sort modes, project restructuring, and npm build support
- Add interactive search filtering (press /) for loaded results - Add explicit sort modes: largest first, newest first, oldest first, name, path - Rewrite interactive UI to use path-based selection instead of index-based - Move CLI entrypoint from root index.ts to src/cli.ts - Extract shared types into src/types.ts (NodeModule, ScanOptions, ScanResult, DeleteResult) - Move deleteModules() to cross-platform fs.rm with Bun fallback - Remove obsolete benchmark scripts (v1-vs-v2, comprehensive, run-benchmark) - Update installed-vs-local benchmark to compare bundled dist vs source cli - Add npm build support (bun build --target bun -> dist/cli.js) - Add prepublishOnly script for automated check + build before npm publish - Add @types/node for proper editor IntelliSense - Add runCli() export in src/cli.ts for root index.ts shim - Clean up comments, remove unused scanner exports (formatSize, formatElapsed) - Update guide.md and BENCHMARK.md to reflect current architecture - Clean .gitignore (remove benchmark dir ignore, remove old zig artifacts) - Fix progress phase accuracy during overlapped sizing pipeline - Fix empty-filter edge cases in interactive mode (cursor, delete confirmation) - Performance: scan is 2x faster than installed bunkill (local source cli ~24s vs installed ~53s on /Users/himanshum) - Overlapped discovery + metadata + size calculation pipeline for non-blocking end-of-scan UX - Lazy git status loading for visible rows only keeps scan speed intact
1 parent a19eb19 commit b0f79fd

13 files changed

Lines changed: 2403 additions & 1580 deletions

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ test
1010
# code coverage
1111
coverage
1212
*.lcov
13-
benchmark
14-
benchmark.md
1513
benchmark-results.json
1614
benchmark-results-comprehensive.json
15+
benchmark-results-installed-vs-local.json
1716
# logs
1817
logs
1918
_.log
@@ -26,6 +25,8 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
2625
.env.production.local
2726
.env.local
2827

28+
guide.md
29+
2930
# caches
3031
.eslintcache
3132
.cache

BENCHMARK.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# BunKill Benchmark Notes
2+
3+
This file documents the benchmark scripts that match the current BunKill codebase.
4+
5+
## Current benchmark scripts
6+
7+
### 1. Installed vs local CLI
8+
9+
Compares three executions on a real directory tree:
10+
11+
- globally installed `bunkill`
12+
- local bundled build (`dist/cli.js`)
13+
- local source CLI (`src/cli.ts`)
14+
15+
Script:
16+
17+
```bash
18+
bun run benchmark/installed-vs-local-benchmark.ts --dir /Users/himanshum --runs 3 --timeout 900000
19+
```
20+
21+
What it measures:
22+
23+
- end-to-end CLI runtime
24+
- BunKill's reported scan time
25+
- discovered `node_modules` count
26+
- alternating run order to reduce cache bias
27+
28+
The script auto-builds `dist/cli.js` if it does not exist.
29+
30+
Latest recorded result values in this file may get stale after scanner changes.
31+
Use the benchmark script output and JSON file as the source of truth.
32+
33+
Output file:
34+
35+
- `benchmark-results-installed-vs-local.json`
36+
37+
### 2. Traversal strategy comparison
38+
39+
Compares the current BunKill scanner with:
40+
41+
- a simple `Bun.Glob` walk
42+
- `npkill` when available
43+
44+
Script:
45+
46+
```bash
47+
bun run benchmark/three-way-benchmark.ts --dir /Users/himanshum --runs 3
48+
```
49+
50+
Notes:
51+
52+
- this benchmark is JS/Bun-only and reflects the current architecture
53+
- the older Zig/native scanner has been removed
54+
- `npkill` may be unavailable or may behave differently in non-interactive environments
55+
56+
## Performance conclusions so far
57+
58+
- the JS/Bun scanner is the default and only implementation now
59+
- the removed Zig/native experiment was slower on the real `/Users/himanshum` workload
60+
- the scan UX was improved so progress becomes visible almost immediately instead of appearing stuck at `0 node_modules found`
61+
- current tuning keeps the near-immediate progress updates without regressing full scan time back to the slower intermediate versions
62+
63+
## Recommended validation flow
64+
65+
For normal development:
66+
67+
```bash
68+
bun run check
69+
bun run src/cli.ts --dir ~/Projects --dry-run
70+
```
71+
72+
For performance validation on the real tree used in this work:
73+
74+
```bash
75+
bun run benchmark/installed-vs-local-benchmark.ts --dir /Users/himanshum --runs 3 --timeout 900000
76+
bun run benchmark/three-way-benchmark.ts --dir /Users/himanshum --runs 3
77+
```
78+
79+
## Important context
80+
81+
- benchmark numbers depend heavily on filesystem cache state and the exact tree contents
82+
- use repeated runs when comparing changes
83+
- prefer the installed-vs-local benchmark when validating user-visible improvement of the CLI

0 commit comments

Comments
 (0)