Skip to content

test: Add benchmarks for JSONB reading, writing, array functions and JSONPath - #110

Merged
sundy-li merged 1 commit into
databendlabs:mainfrom
b41sh:feat/bench
Nov 16, 2026
Merged

sundy-li merged 1 commit into
databendlabs:mainfrom
b41sh:feat/bench

Conversation

@b41sh

@b41sh b41sh commented Nov 16, 2026

Copy link
Copy Markdown
Member

Part 3 of 3 stacked PRs.

Changes

  • benches/read.rs: parsing JSON text into JSONB, and reading JSONB: from_slice, to_value, to_string, from_raw_jsonb, object_each, get_by_name, select_by_path, contains, partial_cmp, convert_to_comparable, strip_nulls.
  • benches/write.rs: building and modifying JSONB: build_array, object_insert, array_insert, concat, delete_by_name, select_array_by_path($.**), to_owned_jsonb, Value::to_vec, and conversion from jaq.
  • benches/array.rs: array_distinct, array_intersection, array_except and array_overlap.
  • benches/json_path.rs: parse_json_path on simple paths, filters with 1 to 256 &&/|| operators, and a name that contains &&.
  • read, write and array run on canada.json, citm_catalog.json, twitter.json and a small object. benches/common/mod.rs holds the documents and the paths and keys used to query them.
  • benches/README.md explains how to run one bench or one case, and how to compare against a saved baseline.
  • Upgrade criterion to 0.8 and simd-json to 0.19.

Tests

cargo test --benches runs each of the 131 benchmarks once, with both feature sets. fmt and clippy (--all-targets -D warnings) pass with both feature sets.

…JSONPath

- `read`, `write` and `array` cover decoding, `to_string`, comparison,
  comparable encoding, building and modifying JSONB, and the array set
  operations, on canada, citm_catalog, twitter and a small document.
- `json_path` covers `parse_json_path` on simple paths, long `&&`/`||`
  chains, and a name that contains `&&`.
- `benches/README.md` explains how to run one case and how to compare
  against a saved baseline.
- Upgrade criterion to 0.8 and simd-json to 0.19.
@b41sh
b41sh requested review from sundy-li and a balanced review from Copilot November 16, 2026 12:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@sundy-li sundy-li left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Checked out the branch: fmt and clippy (--all-targets, both feature sets) are clean, cargo test --benches runs all 131 benchmarks successfully, and the existing parser bench still builds against simd-json 0.19. The Databend profile values in the README (opt-level = "s", codegen-units = 1, lto = "thin") match Databend's [profile.release].

Non-blocking: criterion 0.8.2 needs Rust 1.86 and simd-json 0.19 needs 1.88, both newer than rust-version = "1.85". Main is already above 1.85 through ordered-float 5.5.1 (1.90), proptest and goldenfile, so this PR doesn't change anything. A follow-up bump of rust-version would make it accurate.

@sundy-li
sundy-li merged commit 05feb0b into databendlabs:main Nov 16, 2026
1 check 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