Skip to content

Add NBCROW row throughput benchmark - #292

Draft
Saurabh Singh (saurabh500) wants to merge 1 commit into
mainfrom
dev/saurabh/nbcrow-throughput-benchmark
Draft

Add NBCROW row throughput benchmark#292
Saurabh Singh (saurabh500) wants to merge 1 commit into
mainfrom
dev/saurabh/nbcrow-throughput-benchmark

Conversation

@saurabh500

@saurabh500 Saurabh Singh (saurabh500) commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Description

Adds an end-to-end Criterion benchmark for NBCROW row decoding through the loopback TDS transport and complete next_row path. The matrix covers 4, 16, and 64 columns across fixed-width, text-heavy, and mixed rows with 25% NULLs and 10,000 rows per result set by default.

The existing mock-server infrastructure now emits NBCROW tokens, fragments large responses into valid TDS packets, and caches immutable serialized responses before the timed loop so server-side serialization does not dominate the measurement.

This PR was originally stacked on #245. After #245 squash-merged as 77be0ff6, the benchmark commit was restacked onto main so this PR contains only the issue #282 benchmark work.

Benchmark throughput on the stacked implementation ranged from 1.08 M rows/s for 4-column fixed-width rows to 105 K rows/s for 64-column text-heavy rows. A controlled comparison against the zeroed_bitmap-only implementation found all nine full-row decode deltas within the configured 5% Criterion noise threshold.

Related Issues

Closes #282

Originally stacked on #245; now based on main because #245 merged.

Checklist

  • cargo bfmt passes
  • cargo bclippy passes
  • cargo btest passes — attempted, but live SQL Server integration tests could not connect in the local environment; mock-specific tests pass
  • New/changed functionality has tests
  • Public API changes are documented

Additional validation:

  • cargo nextest run -p mssql-mock-tds --all-targets --no-fail-fast — 20 passed
  • cargo bench -p mssql-tds-bench --bench nbcrow_rows --no-run
  • Full nine-scenario benchmark matrix with BENCH_NBC_ROWS=10000

@saurabh500
Saurabh Singh (saurabh500) force-pushed the dev/saurabh/nbcrow-throughput-benchmark branch from 14a00f2 to 03d37a1 Compare August 14, 2026 16:34
@saurabh500
Saurabh Singh (saurabh500) changed the base branch from copilot/share-nbcrow-null-bitmap to main August 14, 2026 16:34
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@saurabh500
Saurabh Singh (saurabh500) force-pushed the dev/saurabh/nbcrow-throughput-benchmark branch from 03d37a1 to 801f413 Compare August 14, 2026 16:36
async fn connect_mock(address: SocketAddr) -> TdsClient {
let mut context = ClientContext::default();
context.user_name = "sa".to_string();
context.password = "MockBenchmark1!".to_string();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This needs to be randomly generated. WE cannot have hardcoded literals in password

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.

Benchmark NBCROW row throughput to validate the null bitmap allocation optimization

1 participant