Skip to content

Add Benchmark section to command reference pages - #550

Merged
worldsoup merged 4 commits into
mainfrom
add-command-benchmarks
Aug 5, 2026
Merged

Add Benchmark section to command reference pages#550
worldsoup merged 4 commits into
mainfrom
add-command-benchmarks

Conversation

@worldsoup

Copy link
Copy Markdown
Contributor

Summary

  • Adds a shared Benchmark component (throughput bars vs. Redis/Valkey + a methodology table) styled with the docs site's existing design tokens — no colors/typography from the marketing mockup were carried over.
  • Wires it into the 16 command-reference pages that have published results in dragonflydb/benchmarking: GET, SET, HGET, HSET, MGET, MSET, ZADD, ZSCORE, DEL, EXPIRE, INCR, LPOP, LPUSH, RPOP, RPUSH, TTL.
  • All numbers are pulled directly from each command's *_reproduce.md in the benchmarking repo (dfly_bench harness, m7g.8xlarge server / c6gn.8xlarge client, arm64). No placeholder values.

Test plan

  • yarn docusaurus build succeeds with no broken links
  • tsc --noEmit shows no new errors beyond a pre-existing repo-wide JSX namespace warning
  • Verified rendering (dark theme, bar scaling, methodology table) in a local preview for GET, SET, HGET, DEL

🤖 Generated with Claude Code

Adds a shared Benchmark component (throughput bars + methodology table)
and wires it into the 16 command pages that have published results in
dragonflydb/benchmarking: GET, SET, HGET, HSET, MGET, MSET, ZADD,
ZSCORE, DEL, EXPIRE, INCR, LPOP, LPUSH, RPOP, RPUSH, TTL.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
documentation Ready Ready Preview Aug 5, 2026 8:09pm

Request Review

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Add benchmark sections to command reference pages

📝 Documentation ✨ Enhancement 🕐 20-40 Minutes

Grey Divider

AI Description

• Add reusable Benchmark component with throughput bars and methodology table.
• Embed Benchmark sections into 16 command-reference pages with dfly_bench results.
• Link benchmarks back to reproduce harness docs in dragonflydb/benchmarking.
Diagram

graph TD
  Docusaurus["Docusaurus site"] --> Docs["Command MDX pages"] --> Bench["Benchmark component"] --> Styles["Benchmark CSS module"]
  Bench --> BenchRepo{{"dragonflydb/benchmarking"}}
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Centralize benchmark data as JSON/YAML + per-command lookup
  • ➕ Avoids duplicating numeric props across many MDX files
  • ➕ Enables consistent validation and formatting (dates, units, required fields)
  • ➕ Simplifies future updates (single data file change)
  • ➖ Adds a data-loading layer and conventions for mapping command→record
  • ➖ Slightly more complex build-time/runtime wiring in Docusaurus
2. Generate benchmark sections via a script from benchmarking repo inputs
  • ➕ Ensures docs stay synchronized with source reproduce files
  • ➕ Reduces manual editing across many pages
  • ➖ Introduces automation/build tooling to maintain
  • ➖ Requires defining update cadence and handling PR noise from regeneration
3. MDX partials (shared snippet per command family)
  • ➕ Keeps content in MDX without custom data pipelines
  • ➕ Still reduces duplication vs fully inlining props everywhere
  • ➖ Partial organization can get messy as coverage grows beyond 16 commands
  • ➖ Still requires updating partial files when numbers change

Recommendation: The current approach (explicit props per page + shared rendering component) is a good fit for the initial rollout: it’s simple, reviewable, and avoids introducing new build-time data plumbing. If benchmark coverage expands significantly or numbers need frequent refreshes, consider moving the numeric/methodology fields into a centralized data file or generating them from the benchmarking repo to reduce duplication and drift.

Files changed (18) +549 / -0

Enhancement (2) +277 / -0
index.tsxIntroduce Benchmark React component (bars + methodology + harness link) +153/-0

Introduce Benchmark React component (bars + methodology + harness link)

• Adds a reusable component that renders per-engine throughput bars scaled to the max value and computes relative multipliers vs Dragonfly. Renders a methodology table and links to the corresponding reproduce markdown in dragonflydb/benchmarking.

src/components/Benchmark/index.tsx

styles.module.cssAdd Benchmark component styling using docs design tokens +124/-0

Add Benchmark component styling using docs design tokens

• Defines layout and typography for rows, bars, axis ticks/labels, and methodology table. Uses existing theme tokens and the brand gradient for the winner highlight.

src/components/Benchmark/styles.module.css

Documentation (16) +272 / -0
del.mdAdd DEL benchmark section with dfly_bench throughput and methodology +17/-0

Add DEL benchmark section with dfly_bench throughput and methodology

• Imports the shared Benchmark component and appends a Benchmark section. Provides Dragonfly/Valkey/Redis ops/sec plus hardware, client settings, dataset, duration, measured date, and harnessPath link.

docs/command-reference/generic/del.md

expire.mdAdd EXPIRE benchmark section with published throughput results +17/-0

Add EXPIRE benchmark section with published throughput results

• Imports Benchmark and adds a Benchmark section after examples. Includes ops/sec for three engines and a reproducibility link to the benchmarking harness markdown.

docs/command-reference/generic/expire.md

ttl.mdAdd TTL benchmark section with throughput bars and methodology +17/-0

Add TTL benchmark section with throughput bars and methodology

• Adds Benchmark import and embeds a Benchmark section with TTL-specific run parameters. Links back to the TTL reproduce harness path in the benchmarking repo.

docs/command-reference/generic/ttl.md

hget.mdAdd HGET benchmark section referencing benchmarking harness +17/-0

Add HGET benchmark section referencing benchmarking harness

• Adds Benchmark import and a Benchmark section at the end of the page. Supplies ops/sec figures and a harnessPath to the HGET reproduce instructions.

docs/command-reference/hashes/hget.md

hset.mdAdd HSET benchmark section with dfly_bench results +17/-0

Add HSET benchmark section with dfly_bench results

• Imports Benchmark and appends benchmark data and methodology parameters. Includes measured date and a direct link to the reproduce markdown in dragonflydb/benchmarking.

docs/command-reference/hashes/hset.md

lpop.mdAdd LPOP benchmark section with list-dataset parameters +17/-0

Add LPOP benchmark section with list-dataset parameters

• Adds Benchmark import and embeds benchmark results tailored to list workloads (1M lists, 100 items). Includes ops/sec comparisons and a harnessPath for reproducibility.

docs/command-reference/lists/lpop.md

lpush.mdAdd LPUSH benchmark section with throughput comparison +17/-0

Add LPUSH benchmark section with throughput comparison

• Imports Benchmark and adds a Benchmark section with LPUSH ops/sec. Captures the test environment details and links to the LPUSH reproduce harness document.

docs/command-reference/lists/lpush.md

rpop.mdAdd RPOP benchmark section with list workload configuration +17/-0

Add RPOP benchmark section with list workload configuration

• Adds Benchmark import and appends a Benchmark section with RPOP throughput data. Includes dataset details specific to list pop workloads and a harnessPath link.

docs/command-reference/lists/rpop.md

rpush.mdAdd RPUSH benchmark section with published ops/sec +17/-0

Add RPUSH benchmark section with published ops/sec

• Imports Benchmark and embeds benchmark metrics and methodology parameters. Provides a reproducibility link to the RPUSH harness markdown in the benchmarking repo.

docs/command-reference/lists/rpush.md

zadd.mdAdd ZADD benchmark section before best practices +17/-0

Add ZADD benchmark section before best practices

• Adds Benchmark import and inserts a Benchmark section with ZADD throughput bars and methodology. Links to the ZADD reproduce harness doc for raw output and setup details.

docs/command-reference/sorted-sets/zadd.md

zscore.mdAdd ZSCORE benchmark section with sorted-set dataset details +17/-0

Add ZSCORE benchmark section with sorted-set dataset details

• Imports Benchmark and adds a Benchmark section showing ops/sec and relative performance. Includes sorted-set-specific dataset sizing and a harnessPath to reproduce instructions.

docs/command-reference/sorted-sets/zscore.md

get.mdAdd GET benchmark section with throughput visualization +17/-0

Add GET benchmark section with throughput visualization

• Adds Benchmark import and embeds a Benchmark section after usage examples. Supplies ops/sec values and methodology fields plus a harnessPath to the GET reproduce markdown.

docs/command-reference/strings/get.md

incr.mdAdd INCR benchmark section with throughput and methodology +17/-0

Add INCR benchmark section with throughput and methodology

• Imports Benchmark and appends a Benchmark section with INCR ops/sec and run configuration. Links directly to the benchmarking repo reproduce harness for INCR.

docs/command-reference/strings/incr.md

mget.mdAdd MGET benchmark section and reproduce link +17/-0

Add MGET benchmark section and reproduce link

• Adds Benchmark import and includes a Benchmark section with MGET throughput comparisons. Captures consistent hardware/client settings and harnessPath for traceability.

docs/command-reference/strings/mget.md

mset.mdAdd MSET benchmark section with published dfly_bench numbers +17/-0

Add MSET benchmark section with published dfly_bench numbers

• Imports Benchmark and appends a Benchmark section with MSET ops/sec and methodology table inputs. Includes measured date and the MSET reproduce doc path.

docs/command-reference/strings/mset.md

set.mdAdd SET benchmark section with comparative throughput +17/-0

Add SET benchmark section with comparative throughput

• Adds Benchmark import and inserts a Benchmark section near the end of the page. Provides ops/sec values and a harnessPath URL pointing to the SET reproduce markdown.

docs/command-reference/strings/set.md

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Zero-ops division bug 🐞 Bug ☼ Reliability
Description
Benchmark can render invalid widths/ratios (NaN%, Infinity×) because it divides by scale and
engine.ops without guarding against zero values. This yields broken visual output if any
throughput prop is 0 (or all are 0).
Code

src/components/Benchmark/index.tsx[R80-83]

+          const width = ((engine.ops / scale) * 100).toFixed(1) + "%";
+          const relative = engine.isWinner
+            ? "OPS"
+            : (dragonflyOps / engine.ops).toFixed(1) + "× OPS";
Evidence
scale is derived from the max throughput and can become 0 when max is 0, and the render path
divides by scale and engine.ops directly—producing NaN/Infinity strings that get used as a
CSS width and text.

src/components/Benchmark/index.tsx[56-58]
src/components/Benchmark/index.tsx[80-84]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`Benchmark` computes bar widths and relative ratios via division by `scale` and `engine.ops` without validating that they are > 0. If any input is 0 (or all are 0), the component will generate invalid CSS widths (e.g. `NaN%`) and/or display ratios like `Infinity× OPS`.

### Issue Context
This component is now shared across multiple docs pages; even if current pages pass only positive values, future additions/edits (or partial/placeholder data) can easily introduce zeros.

### Fix Focus Areas
- src/components/Benchmark/index.tsx[56-58]
- src/components/Benchmark/index.tsx[80-84]

### Suggested fix
- Ensure `scale` is never 0 (e.g., `const scale = max > 0 ? ... : 1;`) and consider clamping negative values.
- When computing `relative`, handle `engine.ops <= 0` explicitly (e.g., show `"—"` instead of dividing).
- Optionally, short-circuit rendering with a “No benchmark data” message when `max <= 0`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Hardcoded winner styling 🐞 Bug ≡ Correctness
Description
Benchmark hardcodes Dragonfly as isWinner: true, so the highlighted “winner” styling can
disagree with the actual max throughput if values change or the component is reused. This can
mislead readers because the UI implies the highlighted row is the best performer.
Code

src/components/Benchmark/index.tsx[R50-54]

+  const engines = [
+    { name: "Dragonfly", ops: dragonflyOps, isWinner: true },
+    { name: "Valkey", ops: valkeyOps, isWinner: false },
+    { name: "Redis", ops: redisOps, isWinner: false },
+  ];
Evidence
The engines list hardcodes isWinner for Dragonfly while max is computed separately, meaning
winner styling is not actually driven by the measured throughput values.

src/components/Benchmark/index.tsx[50-56]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The component currently encodes “winner” as “Dragonfly” via a hardcoded `isWinner` flag. If future benchmark data ever shows Redis/Valkey higher (or if a typo swaps values), the component will still style Dragonfly as the winner.

### Issue Context
`max` is already computed, but not used to determine the winner. The `isWinner` flag also controls both the highlighted styles and the `relative` label logic.

### Fix Focus Areas
- src/components/Benchmark/index.tsx[50-57]
- src/components/Benchmark/index.tsx[81-90]

### Suggested fix
- Compute winner/leader dynamically from `max` (and define tie behavior), e.g. set `isWinner: ops === maxOps`.
- If you still want Dragonfly always visually distinct, separate concerns:
 - `isPrimary` (Dragonfly) for baseline styling/ratio logic, and
 - `isLeader` (max ops) for winner styling.
- Update `relative` text logic accordingly so it remains meaningful when Dragonfly is not the leader.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

Comment on lines +80 to +83
const width = ((engine.ops / scale) * 100).toFixed(1) + "%";
const relative = engine.isWinner
? "OPS"
: (dragonflyOps / engine.ops).toFixed(1) + "× OPS";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

1. Zero-ops division bug 🐞 Bug ☼ Reliability

Benchmark can render invalid widths/ratios (NaN%, Infinity×) because it divides by scale and
engine.ops without guarding against zero values. This yields broken visual output if any
throughput prop is 0 (or all are 0).
Agent Prompt
### Issue description
`Benchmark` computes bar widths and relative ratios via division by `scale` and `engine.ops` without validating that they are > 0. If any input is 0 (or all are 0), the component will generate invalid CSS widths (e.g. `NaN%`) and/or display ratios like `Infinity× OPS`.

### Issue Context
This component is now shared across multiple docs pages; even if current pages pass only positive values, future additions/edits (or partial/placeholder data) can easily introduce zeros.

### Fix Focus Areas
- src/components/Benchmark/index.tsx[56-58]
- src/components/Benchmark/index.tsx[80-84]

### Suggested fix
- Ensure `scale` is never 0 (e.g., `const scale = max > 0 ? ... : 1;`) and consider clamping negative values.
- When computing `relative`, handle `engine.ops <= 0` explicitly (e.g., show `"—"` instead of dividing).
- Optionally, short-circuit rendering with a “No benchmark data” message when `max <= 0`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +50 to +54
const engines = [
{ name: "Dragonfly", ops: dragonflyOps, isWinner: true },
{ name: "Valkey", ops: valkeyOps, isWinner: false },
{ name: "Redis", ops: redisOps, isWinner: false },
];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

2. Hardcoded winner styling 🐞 Bug ≡ Correctness

Benchmark hardcodes Dragonfly as isWinner: true, so the highlighted “winner” styling can
disagree with the actual max throughput if values change or the component is reused. This can
mislead readers because the UI implies the highlighted row is the best performer.
Agent Prompt
### Issue description
The component currently encodes “winner” as “Dragonfly” via a hardcoded `isWinner` flag. If future benchmark data ever shows Redis/Valkey higher (or if a typo swaps values), the component will still style Dragonfly as the winner.

### Issue Context
`max` is already computed, but not used to determine the winner. The `isWinner` flag also controls both the highlighted styles and the `relative` label logic.

### Fix Focus Areas
- src/components/Benchmark/index.tsx[50-57]
- src/components/Benchmark/index.tsx[81-90]

### Suggested fix
- Compute winner/leader dynamically from `max` (and define tie behavior), e.g. set `isWinner: ops === maxOps`.
- If you still want Dragonfly always visually distinct, separate concerns:
  - `isPrimary` (Dragonfly) for baseline styling/ratio logic, and
  - `isLeader` (max ops) for winner styling.
- Update `relative` text logic accordingly so it remains meaningful when Dragonfly is not the leader.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@odedponcz odedponcz 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.

I see RPS numbers but not latency. Why?

vyavdoshenko
vyavdoshenko previously approved these changes Aug 4, 2026
@worldsoup

Copy link
Copy Markdown
Contributor Author

@odedponcz you had originally said to just show throughput...I can add latency too

Renders the harness's per-engine p50/p99/p99.9/avg-latency rows
(from each command's Expected results section) as a simple table
directly beneath the throughput bars, above Methodology.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Adds scripts/sync-benchmarks.ts, which fetches the benchmarking repo,
parses each command's *_reproduce.md (Stateful setup, Test run flags,
and Expected results table), and regenerates the marked <Benchmark>
block on the matching command-reference page — auto-picking up new
commands as they're added upstream. Idempotent: reruns with unchanged
upstream data touch nothing.

Wired into .github/workflows/sync-benchmarks.yml, which runs the
script daily and opens a PR only when something actually changed, so
updates to published performance numbers get reviewed rather than
landing silently on every build.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@worldsoup
worldsoup merged commit a89dff7 into main Aug 5, 2026
3 checks passed
@worldsoup
worldsoup deleted the add-command-benchmarks branch August 5, 2026 20:14
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