Skip to content

refactor: move benchmarks to separate crate#148

Merged
ChunxuTang merged 1 commit intolance-format:mainfrom
beinan:refactor/separate-benchmark-crate
Mar 5, 2026
Merged

refactor: move benchmarks to separate crate#148
ChunxuTang merged 1 commit intolance-format:mainfrom
beinan:refactor/separate-benchmark-crate

Conversation

@beinan
Copy link
Collaborator

@beinan beinan commented Mar 4, 2026

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

# 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.

Move benchmarks from lance-graph to a new lance-graph-benches crate
to exclude them from release binaries and reduce build times.

Changes:
- Create new crate: lance-graph-benches (publish = false)
- Move graph_execution benchmark to new crate
- Remove benchmark-only dependencies from lance-graph:
  - criterion (benchmarking framework)
  - lance-index (unused)
- Update workspace to include lance-graph-benches
- Add README for benchmark crate

Benefits:
- Smaller release binaries (benchmark code excluded)
- Faster production builds (benchmarks only built when needed)
- Cleaner separation of concerns
- All existing tests still pass (295 tests)

Usage:
  cargo bench -p lance-graph-benches

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@beinan beinan force-pushed the refactor/separate-benchmark-crate branch from 41e62a5 to a31e4cd Compare March 4, 2026 23:36
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@beinan beinan requested a review from ChunxuTang March 5, 2026 06:33
@ChunxuTang ChunxuTang merged commit 543a4df into lance-format:main Mar 5, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants