refactor(bench): isolate external engine comparisons - #8
Merged
farhan-syah merged 2 commits intoJul 21, 2026
Merged
Conversation
…olver v3 Cargo's resolver 2 unifies features across the default and all-features builds, so the CI leak check could miss external engines pulled in only under --all-features. Bumping to resolver 3 keeps builds isolated per feature set, and the workflow now runs the cargo-tree leak check against both the default and --all-features dependency graphs.
farhan-syah
approved these changes
Jul 21, 2026
farhan-syah
left a comment
Member
There was a problem hiding this comment.
Solid refactor — gives the comparison engines an honest dependency boundary without touching any workload. Verified the two things a mechanical move could silently break:
fastrandremoval is safe (dev-only, unused insrc/and in the retainedsegmentbench);- the moved benches'
tokioruntime features (sync/time/fsfor.enable_all()+tokio::sync::Mutex) survive via feature unification through thepagedbpath-dep, so no runtime regression despite--no-run.
I pushed one fixup commit (a48863f) with two small hardenings:
- the leak-check gate now runs
cargo treeunder both default and--all-features, so a feature-gated engine leak can't slip past; resolver = "3"to match the edition-2024 default (MSRV-aware);cargo metadata --lockedconfirmsCargo.lockis unchanged.
Gate passes clean locally for both feature sets; cargo fmt --all --check and YAML parse both pass.
farhan-syah
marked this pull request as ready for review
July 21, 2026 13:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR moves the native cross-engine benchmarks into an opt-in workspace package so PageDB's ordinary development, test, feature, documentation, and cross-target jobs no longer resolve or compile RocksDB, redb, or SQLite.
PageDB itself keeps the native
segmentbenchmark. The existingbtreeandcomparisonworkloads remain available underbenchmarks/engine-comparisonand continue to compare the same engines with the same workload parameters. This is a packaging and CI-boundary change, not a benchmark rewrite.Problem
The three external engines were unconditional root
dev-dependencies. Cargo includes root dev-dependencies in test and benchmark dependency resolution, so commands such ascargo nextest run,cargo clippy --all-targets, and feature-matrix checks pulled inlibrocksdb-syseven when no comparison benchmark was requested.That had several undesirable effects:
test = falseprevented benchmark executables from running as tests, but it could not remove their root dev-dependencies from Cargo's package graph;Design
The root manifest is now a workspace with two deliberately different package boundaries:
pagedbremains the default workspace member and owns the library, tests, binaries, and PageDB-onlysegmentbenchmark.pagedb-engine-comparisonis a non-publishable, non-default package that owns thebtreeand four-enginecomparisonbenchmarks plus their benchmark-only dependencies.The comparison package declares PageDB, fluxbench, fastrand, tempfile, Tokio, redb, RocksDB, and rusqlite as dev-dependencies. It has no library or production target and is only selected when its benchmark package is named explicitly.
This keeps two distinct concerns visible:
Protocol-level, browser-runtime, or storage-plugin comparisons are different semantic workloads and should remain in their respective integration harnesses rather than being conflated with this raw embedded-engine suite.
Changes
Cargo boundary
default-members = ["."].benchmarks/engine-comparisonpackage.btree.rsandcomparison.rsinto that package.redb,rocksdb,rusqlite, and the benchmark-only directfastranddependency from PageDB's root dev-dependencies.segment.rsas PageDB's only root benchmark target.Cargo.lockso the external engines belong topagedb-engine-comparison, notpagedb.CI boundary
-p pagedb.segmentplus the isolatedbtreeandcomparisontargets.Documentation
Workload preservation
No benchmark case, parameter, engine adapter, comparison group, or measurement configuration was removed.
Both moved Rust files are byte-for-byte identical to upstream after accounting for one documentation-only change in each file: the run command now includes
-p pagedb-engine-comparison. Git detects both moves as 99% renames.The following remain unchanged:
Verification
Dependency and source-boundary checks:
cargo metadata --locked --format-version 1cargo tree -p pagedb --edges normal,build,dev— no RocksDB, redb, rusqlite, librocksdb-sys, or libsqlite3-syscargo package -p pagedb --allow-dirty --no-verify --list— root package containsbenches/segment.rsand excludes the nested comparison packageCore validation:
cargo fmt --all --checkgit diff --checkactionlint .github/workflows/test.ymlcargo test -p pagedb --lib— 133 passedcargo nextest run -p pagedb --all-features --no-fail-fast— 388 passedcargo doc -p pagedb --no-deps --all-features— passedcargo test -p pagedb --doc --all-features— passedcargo deny --exclude-dev check— passedcargo check -p pagedb --target wasm32-unknown-unknown --lib --features opfs— passedcargo check -p pagedb --target wasm32-wasip1 --lib— passedBenchmark compilation:
cargo bench --no-run -p pagedb --bench segment— passedcargo bench --no-run -p pagedb-engine-comparison --bench btree --bench comparison— passedReview notes
The PR intentionally does not change benchmark numbers or claim new performance results. Existing tables remain descriptions of the existing workloads; this change only gives those workloads an honest dependency boundary.
The new CI gate is meant to make the architectural constraint durable. If a future PageDB feature genuinely needs one of these engines in core, that should be an explicit design decision accompanied by removal or revision of the gate, rather than an accidental dev-dependency leak.