Skip to content

Commit 543a4df

Browse files
beinanclaude
andauthored
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

Cargo.lock

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ members = [
33
"crates/lance-graph",
44
"crates/lance-graph-catalog",
55
"crates/lance-graph-python",
6+
"crates/lance-graph-benches",
67
]
78
resolver = "2"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[package]
2+
name = "lance-graph-benches"
3+
version = "0.1.0"
4+
edition = "2021"
5+
publish = false
6+
description = "Benchmarks for lance-graph (not published)"
7+
8+
[dependencies]
9+
lance-graph = { path = "../lance-graph", version = "0.5.3" }
10+
lance = "1.0.0"
11+
arrow-array = "56.2"
12+
arrow-schema = "56.2"
13+
criterion = { version = "0.5", features = ["async", "async_tokio", "html_reports"] }
14+
futures = "0.3"
15+
tempfile = "3"
16+
tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] }
17+
18+
[[bench]]
19+
name = "graph_execution"
20+
harness = false
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Lance Graph Benchmarks
2+
3+
Performance benchmarks for the `lance-graph` crate.
4+
5+
## Running Benchmarks
6+
7+
From the repository root:
8+
9+
```bash
10+
# Run all benchmarks
11+
cargo bench -p lance-graph-benches
12+
13+
# Run specific benchmark
14+
cargo bench -p lance-graph-benches --bench graph_execution
15+
```
16+
17+
## Benchmarks
18+
19+
- **graph_execution**: End-to-end query execution benchmarks
20+
- Basic node filtering and projection
21+
- Single-hop relationship expansion
22+
- Two-hop relationship expansion
23+
- Tests with datasets of varying sizes (100, 10K, 1M rows)
24+
25+
## Note
26+
27+
This crate is not published to crates.io and is excluded from releases.
28+
It exists solely for performance testing during development.
File renamed without changes.

crates/lance-graph/Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,7 @@ unity-catalog = ["lance-graph-catalog/unity-catalog"]
4747
delta = ["dep:deltalake", "dep:url"]
4848

4949
[dev-dependencies]
50-
criterion = { version = "0.5", features = ["async", "async_tokio", "html_reports"] }
5150
futures = "0.3"
5251
lance-arrow = "1.0.0"
53-
lance-index = "1.0.0"
5452
tempfile = "3"
5553
tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] }
56-
57-
[[bench]]
58-
name = "graph_execution"
59-
harness = false

0 commit comments

Comments
 (0)