Skip to content

feat(bench): add the B1 predicate-pushdown bench + zstd|grep reference - #115

Merged
jensholdgaard merged 1 commit into
mainfrom
feat/b1-bench
Jun 5, 2026
Merged

feat(bench): add the B1 predicate-pushdown bench + zstd|grep reference#115
jensholdgaard merged 1 commit into
mainfrom
feat/b1-bench

Conversation

@jensholdgaard

@jensholdgaard jensholdgaard commented Jun 4, 2026

Copy link
Copy Markdown
Owner

What

Second step of the B1/B2 measurement plan (after #114 added the severity_text predicate): a wall-clock B1 instrument plus an honest baseline.

B1's thesis gate (docs/benchmarks.md §3): Ourios ≥10× faster than zstdcat files_in_range.zst | grep ERROR | wc -l on predicate queries.

How

  • ReferenceCorpus (src/reference.rs) — the in-process equivalent of the zstdcat | grep TOKEN | wc -l pipeline: no system zstd/grep binary (reproducible on any host; same bundled zstd as the A1 codec). Fairness is explicit: the caller passes only the in-window files' raw lines — the file-level pruning the baseline gets for free by naming files_in_range.zst — and within those the reference scans every line, where Ourios additionally skips row groups via column statistics. So the ratio measures within-window pruning, not a strawman.
  • benches/b1.rsb1/synthetic (always runs): a query window of ERROR rows (one file) + INFO rows (another), plus out-of-window ERROR filler. The Ourios query (tenant + time window + severity_text='ERROR') prunes the INFO row group (severity stats) and the out-of-window file (time stats); the reference greps the same in-window files. Both return the same count; the bench prints the pruned fraction + times each side.

Indicative result (laptop, scratch/, NOT recorded in §9)

b1/synthetic: result=2000 rows; ourios pruned 2/3 row groups, read 3938 B; reference scans 2517 in-window compressed B
b1/synthetic/ourios               1.008 ms
b1/synthetic/zstd-grep-reference  90.6 µs

The pruning mechanism works (2/3 row groups skipped — only the in-window ERROR row group read). But at this toy scale Ourios is ~11× slower on wall clock: the query is dominated by fixed per-query DataFusion overhead (~1 ms: context + schema inference + plan build), while the reference is a trivial decode+scan of 2.5 KB. This is the same small-corpus regime as the b2/synthetic finding — B1's 10× win is explicitly a ≥1 GiB claim (the reference's cost grows with corpus bytes; Ourios's stays ~flat). The synthetic arm is a correctness/mechanism instrument; the wall-clock win needs the real corpus.

Deferred

b1/otel-demo needs the OTLP/JSON loader's per-record severity (the plain-text loader forces a constant INFO, so a severity='ERROR' query over a mined text corpus returns nothing) plus in-window raw-line extraction with a real time window. Wired in the corpus run (Phase 2).

Tests / verification

  • ReferenceCorpus unit tests (in-window-only counting; empty corpus).
  • cargo bench --bench b1 -- --test runs both sides + the probe assertions.
  • Local: cargo fmt --all --check, cargo clippy --workspace --all-targets --all-features -D warnings, cargo test --workspace all green.

Part of epic #81 (thesis-gate benchmark validation).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Added B1 benchmark for query latency measurement with synthetic data and baseline comparison.
    • Implemented reference corpus module to verify query result correctness.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jensholdgaard, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 46 minutes and 36 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2856ea8f-d5cb-408f-9c5a-480afb13048e

📥 Commits

Reviewing files that changed from the base of the PR and between 28111b6 and a3bf366.

📒 Files selected for processing (4)
  • crates/ourios-bench/Cargo.toml
  • crates/ourios-bench/benches/b1.rs
  • crates/ourios-bench/src/lib.rs
  • crates/ourios-bench/src/reference.rs
📝 Walkthrough

Walkthrough

This PR introduces a B1 Criterion benchmark for Ourios that constructs a synthetic Parquet dataset, validates correctness and row-group pruning, and measures query latency against a fair in-process zstd-compressed reference corpus.

Changes

B1 Synthetic Benchmark

Layer / File(s) Summary
ReferenceCorpus baseline implementation
crates/ourios-bench/src/reference.rs, crates/ourios-bench/src/lib.rs
Introduces ReferenceCorpus struct that compresses log lines into per-file zstd blocks and counts lines matching a token via byte-level substring search. Public methods compress(), count_lines_containing(), and compressed_bytes() support fair single-threaded reference measurement, with unit tests validating correct counts and zero edge cases.
B1 benchmark with Criterion
crates/ourios-bench/Cargo.toml, crates/ourios-bench/benches/b1.rs
Registers B1 benchmark that builds three hourly synthetic Parquet files (ERROR in-window, INFO in-window, ERROR out-of-window), constructs a matching reference corpus from in-window lines only, asserts Ourios row-count equivalence and row-group pruning, then measures query latency against reference corpus "ERROR" line counting via Criterion black-box iteration.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A benchmark born of zstd-compressed dreams,
Where Ourios queries dance through Parquet streams,
Row groups pruned, fairness held tight,
The B1 check shines with predicate light!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a B1 predicate-pushdown benchmark with a zstd|grep reference baseline.
Description check ✅ Passed The description is comprehensive and well-structured, covering the what, how, results, deferred work, and verification. However, it lacks explicit coverage of the checklist items from the template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/b1-bench

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jensholdgaard
jensholdgaard requested a review from Copilot June 4, 2026 23:01
@jensholdgaard

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new B1 benchmark (“predicate-pushdown query latency”) and an in-process zstdcat | grep | wc -l-style baseline comparator to support the thesis-gate measurement plan in the bench harness.

Changes:

  • Introduces ReferenceCorpus (compressed in-window raw lines + token scan) as the B1 “zstd|grep” baseline.
  • Adds benches/b1.rs synthetic benchmark that measures Ourios vs the reference on the same in-window file set.
  • Wires the new b1 Criterion bench target into crates/ourios-bench and exports ReferenceCorpus.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
crates/ourios-bench/src/reference.rs Adds the in-process “zstd
crates/ourios-bench/src/lib.rs Exposes the new reference module and re-exports ReferenceCorpus.
crates/ourios-bench/Cargo.toml Registers the new b1 Criterion benchmark target.
crates/ourios-bench/benches/b1.rs Adds the B1 synthetic benchmark comparing Ourios query latency vs the reference baseline.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/ourios-bench/src/reference.rs Outdated
Comment thread crates/ourios-bench/src/reference.rs
Comment thread crates/ourios-bench/src/reference.rs
@jensholdgaard

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread crates/ourios-bench/benches/b1.rs
@jensholdgaard

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread crates/ourios-bench/src/reference.rs Outdated
Comment thread crates/ourios-bench/src/reference.rs
@jensholdgaard

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread crates/ourios-bench/src/lib.rs Outdated
Comment thread crates/ourios-bench/src/reference.rs Outdated
@jensholdgaard

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread crates/ourios-bench/src/reference.rs
@jensholdgaard

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread crates/ourios-bench/src/reference.rs
Comment thread crates/ourios-bench/src/reference.rs

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/ourios-bench/src/reference.rs`:
- Around line 86-95: The compressed_bytes method currently uses
u64::try_from(b.len()).unwrap_or(u64::MAX) which silently substitutes a max
value; change this to use expect with an explicit assumption to match crate
convention: replace the unwrap_or(u64::MAX) on the try_from result inside
compressed_bytes (the fold over self.blocks) with .expect("usize fits in u64 on
every supported Rust target") so the conversion is infallible by contract and
failures are explicit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 15446077-ec43-4049-8510-54d8c9c40215

📥 Commits

Reviewing files that changed from the base of the PR and between 69befe2 and 28111b6.

📒 Files selected for processing (4)
  • crates/ourios-bench/Cargo.toml
  • crates/ourios-bench/benches/b1.rs
  • crates/ourios-bench/src/lib.rs
  • crates/ourios-bench/src/reference.rs

Comment thread crates/ourios-bench/src/reference.rs
Second step of the B1/B2 measurement plan: a wall-clock B1 instrument
(docs/benchmarks.md §3 B1 / RFC0007.1) alongside an honest baseline.

- `ReferenceCorpus` (src/reference.rs): the in-process equivalent of
  `zstdcat files_in_range.zst | grep TOKEN | wc -l` — no system zstd/grep,
  reproducible on any host (same bundled zstd as the A1 codec). Fairness:
  the caller passes ONLY the in-window files' raw lines (the file-level
  pruning the baseline gets for free); within those it scans every line,
  where Ourios additionally skips row groups via column statistics — so
  the ratio reflects within-window pruning, not a strawman full scan.
- `benches/b1.rs` — `b1/synthetic` (always runs): a window of ERROR rows
  (one file) + INFO rows (another), plus out-of-window ERROR filler. The
  Ourios query (tenant + time window + severity_text='ERROR') prunes the
  INFO row group (severity stats) and the out-of-window file (time stats);
  the reference greps the same in-window files. Both return the same
  count; the bench prints the pruned fraction and times each side.

`b1/otel-demo` is deferred to the corpus run: it needs the OTLP/JSON
loader's per-record severity (the plain-text loader forces INFO) plus
in-window raw-line extraction with a real time window.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jensholdgaard

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread crates/ourios-bench/src/reference.rs
Comment thread crates/ourios-bench/benches/b1.rs
@jensholdgaard
jensholdgaard merged commit 166662b into main Jun 5, 2026
11 checks passed
@jensholdgaard
jensholdgaard deleted the feat/b1-bench branch June 5, 2026 05:43
jensholdgaard added a commit that referenced this pull request Jun 11, 2026
…ed column (#178)

Specs the effective-timestamp fallback (maintainer option 1, 2026-06-11): derived effective_time_unix_nano = time_unix_nano when non-zero, else observed_time_unix_nano.unwrap_or(0) — per the OTLP logs data model's "Use Timestamp if it is present, otherwise use ObservedTimestamp" recommendation. New OPTIONAL stats-bearing RFC 0005 column (writer-derived; MinedRecord unchanged; RFC0001.10 verbatim preservation intact); range() shall filter it; absent-column read rule effective := time_unix_nano (explicit carve-out from the absent⇒false convention) so old files behave identically; partitioning already fell back (choose_partition_timestamp) — now named/unified. RFC 0002 additionally pins half-open [from,to) window bounds (closing RFC 0010's local-pin gap). Scenario RFC0005.13 added.

Unblocks B1 on the v5/v6 corpora (~15% observed-only records). Final round merged under the PR #115 trivial-only convergence precedent (wording-only round; CodeRabbit + CI green).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
jensholdgaard added a commit that referenced this pull request Jun 11, 2026
…C 0007 stays green (#180)

Records the maintainer-authorized (2026-06-12) thesis-gate measurements in docs/benchmarks.md §9 per its conventions:

- §9.2 — A1/C1/C2 at ~1GB (runs 27370641352, 27373716667): A1 0.828×/0.824× FAIL (series 0.465→0.824, size-driven, crossover not reached); C1 1.000000 both (the formal ≥1M-line gate); C2 PASS.
- §9.3 — the FIRST B1 real-corpus readings (runs 27379085890, 27357104694): v5 40.0× / v6 30.4× vs zstdcat|grep with exact row-count matches — the §3 ≥10× gate passes indicatively; B2 PASS-supportive (windowed flat ~3.4–4.1ms vs full-span growth). All ci-runner, caveats recorded plainly.
- RFC 0007 stays GREEN: the ladder requires baseline-8vcpu-32gib for validated; the status note carries the validated-pending checklist (baseline rerun REQUIRED; denser error band + second corpus family supporting).
- query-bench.yml stale recording note fixed (RFC 0006 §1 anticipated B1/B2 recording — no amendment needed).

Final round merged under the PR #115 trivial-only convergence precedent.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
jensholdgaard added a commit that referenced this pull request Jun 12, 2026
…182)

Records the authoritative baseline-8vcpu-32gib thesis-gate results in §9.4 (A1 series 0.439→0.751/0.749 FAIL w/ a hardware-sensitivity open item; C1 1.000000 everywhere; C2 PASS; B1 34.2×/25.4× PASS with exact counts; B2 flat incl. the first second-corpus-family reading — HDFS_v1, 11.2M rows, windowed 5.92ms scanning 1/14 row groups) and flips RFC 0007 to validated per the verification.md §3 ladder (the gates the querier pillar touches — B1/B2 — pass authoritatively; A1 gates the compression pillar/RFC 0006). Final round merged under the PR #115 trivial-only convergence precedent.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
jensholdgaard added a commit that referenced this pull request Jun 12, 2026
README predated all code (2026-04-24). Now: truthful pre-release status block; live badges (CI, self-hosted coverage endpoint at 87.8%, OpenSSF Scorecard [activates on first main run], License, Rust/MSRV, mdBook); corrected ingest diagram (WAL-before-ack order); shipped feature syntax (template_id == 42, resolves_to, drift from -7d to now); real repo layout; bench section cites §9 as the live scoreboard. Best Practices + Codecov left as maintainer-enrollment placeholders. Final round wording-only, merged under the PR #115 precedent.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
jensholdgaard added a commit that referenced this pull request Jun 12, 2026
… derivation (#183)

Pins the #148 alias-index write path persistence: alias_asserted(4)/alias_retracted(5) audit event kinds with kind-prefixed OPTIONAL columns (alias_member_ids LIST<INTEGER(64, signed=false)> per the positions_widened precedent; alias_representative_id own column; alias_actor; reason reused w/ ""-NULL rule); the unknown-event_kind tolerance rule (opaque envelope events, never file failures — the writer's interim rejection retires in the impl slice as an RFC-gated contract change); and the v1 read path: the querier folds the per-tenant alias map from the audit stream at compile time with a total (timestamp, file path, row index) fold order. The cached per-tenant artifact stays deferred behind the RFC 0009 §3.4 manifest fork (#94/#147) — the event log is the truth either way. Final round wording-only, merged under the PR #115 precedent.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants