feat: add benchmarks, expanded proptest, and cargo-fuzz targets#9
Merged
feat: add benchmarks, expanded proptest, and cargo-fuzz targets#9
Conversation
e800bef to
2ac4f42
Compare
Member
Author
|
[Claude Code] Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Evalir
approved these changes
Apr 7, 2026
Member
Evalir
left a comment
There was a problem hiding this comment.
that's a lot of tests :D the docs make sense, and i think the debug-based validation approach makes sense
Fraser999
reviewed
Apr 7, 2026
Contributor
Fraser999
left a comment
There was a problem hiding this comment.
Claude made the following assessment of the parity benchmarks:
Critical mismatches (results not comparable)
cursor_write::put::sync vs write_put_100
| Aspect | mdbx | evmdb |
|---|---|---|
| Txn creation | In setup (untimed) | In timed path |
| Commit | Never (aborts) | Commits every iteration |
| Key ordering | Sorted, same every iteration | Random XOR-scrambled, different every iteration |
| DB state across iterations | Empty (abort resets) | Grows (commits accumulate) |
cursor_write::append::sync vs write_put_100_sorted
All the same mismatches as put::sync vs write_put_100, plus:
| Aspect | mdbx | evmdb |
|---|---|---|
| Operation | cursor.append() (MDBX_APPEND flag) |
Regular put() in sorted order |
These are fundamentally different operations - append is an optimized path that skips B+tree traversal.
cold_sequential_scan (mdbx) vs cold_sequential_scan (evmdb)
| Aspect | mdbx | evmdb |
|---|---|---|
| Operation | Cursor scan (cursor.next() loop) |
N individual point lookups (get_blocking) |
| Entry count | 1,000,000 | 10,000 |
| Env lifecycle | Reopens environment each iteration | Keeps DB open, flushes cache |
evmdb's version is not actually a "scan" - it's N independent B+tree traversals from root.
cold_random_get (mdbx) vs cold_random_get (evmdb)
| Aspect | mdbx | evmdb |
|---|---|---|
| Entry count | 1,000,000 | 10,000 |
| Lookup count | 1,000 | 100 |
| Env lifecycle | Reopens environment each iteration | Keeps DB open, flushes cache |
Significant mismatches
append_ordered_put vs put_sorted
| Aspect | mdbx | evmdb |
|---|---|---|
| Operation | txn.append() (MDBX_APPEND) |
Regular put() in sorted order |
| Commit batching | Single commit for all N entries | Batches of 1000, commit after each batch |
readers_no_writer and readers_one_writer
| Aspect | mdbx | evmdb |
|---|---|---|
| Reader work | Reads value, accumulates val.len() |
Checks is_some() only |
sequential_get and random_get
| Aspect | mdbx | evmdb |
|---|---|---|
| Reader work | Reads value via Cow<[u8]>, accumulates val.len() |
Checks is_some() only |
Minor
- Entry counts differ by default for all scaling benchmarks: mdbx omits 100K without
BENCH_FULL=1; evmdb always includes 100K.
- Benchmarks: Add cursor writes, reserve vs put, nested transactions, concurrency (up to 128 readers), and scaling (100 to 100K entries × 32/128/512B values). - Proptest: Split monolithic proptest_inputs.rs into 6 domain-focused files (kv, cursor, dupsort, dupfixed, iter, nested). DUPFIXED tests cover both sync and unsync transactions. - Fuzz: Set up cargo-fuzz with 6 targets focused on FFI/unsafe boundaries. Debug assertions enabled in fuzz release profile. - Document debug-only input validation model in README and lib.rs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
c3148b9 to
02c20b4
Compare
Fraser999
approved these changes
Apr 7, 2026
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
proptest_inputs.rsinto 6 domain-focused files (kv, cursor, dupsort, dupfixed, iter, nested). Migrate all existing tests and add new cases for large values, multi-db isolation, DUPFIXED page spanning, nested txn semantics, and more. DUPFIXED tests cover both sync and unsync transactions.cargo-fuzzwith 6 targets focused on FFI/unsafe boundaries —Cow<[u8]>decode paths, fixed-size array decode, dirty page roundtrip, DUPFIXED page decode (with iterator exercise), and key validation. Debug assertions enabled in fuzz release profile.return-borrowedfeature documentation from iter module. Remove all evmdb/parity references.Test plan
cargo t)cargo bench)--all-targets)cargo +nightly fmtappliedcargo +nightly fuzz run <target>)🤖 Generated with Claude Code