Commit 543a4df
refactor: move benchmarks to separate crate (#148)
## Summary
Moves benchmarks from `lance-graph` to a new `lance-graph-benches` crate
to exclude them from release binaries and reduce build times for
production code.
## Changes
### New Crate: `lance-graph-benches`
- Created dedicated benchmark crate with `publish = false`
- Moved `graph_execution` benchmark from `lance-graph`
- Added README with usage instructions
### Cleaned Up `lance-graph`
- ✅ Removed benchmark-only dependencies:
- `criterion` (benchmarking framework)
- `lance-index` (unused)
- ✅ Kept test dependencies:
- `tempfile` (used by tests)
- `lance-arrow` (used by tests)
- `tokio`, `futures` (used by tests)
- ✅ Removed `[[bench]]` section from Cargo.toml
### Workspace
- Added `lance-graph-benches` to workspace members
## Benefits
✅ **Smaller Release Binaries** - Benchmark code excluded from published
crates
✅ **Faster Production Builds** - Benchmarks only compiled when
explicitly requested
✅ **Cleaner Separation** - Dev/benchmark code separate from production
code
✅ **All Tests Pass** - 295 unit tests still passing
✅ **Benchmarks Work** - Verified compilation and structure
## Usage
```bash
# Run all benchmarks
cargo bench -p lance-graph-benches
# Run specific benchmark
cargo bench -p lance-graph-benches --bench graph_execution
# Build production crate (benchmarks NOT included)
cargo build -p lance-graph
```
## Testing
- ✅ `cargo check -p lance-graph` - success
- ✅ `cargo build -p lance-graph` - success
- ✅ `cargo test -p lance-graph --lib` - 295 tests pass
- ✅ `cargo check -p lance-graph-benches` - success
- ✅ No benchmark code in production binary
## File Structure
```
crates/lance-graph-benches/
├── benches/
│ └── graph_execution.rs
├── Cargo.toml (publish = false)
└── README.md
```
This follows the common Rust pattern of separating benchmarks into
dedicated crates when they have heavy dependencies or shouldn't be
included in releases.
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 34fb4f5 commit 543a4df
6 files changed
Lines changed: 63 additions & 8 deletions
File tree
- crates
- lance-graph-benches
- benches
- lance-graph
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | 50 | | |
52 | 51 | | |
53 | | - | |
54 | 52 | | |
55 | 53 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
0 commit comments