# Run Rust Benchmarks

> Run Rust benchmarks and compare performance with the C implementation. Use this when you work on migrating C code to Rust and want to ensure performance is not regressed.

- Skill: `redisearch/run-rust-benchmarks` (Agent Skill)
- Install (CLI): `npx skillmds@latest add redisearch/run-rust-benchmarks`
- Raw SKILL.md: https://api.skillmd.com/api/skills/redisearch/run-rust-benchmarks/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: RediSearch (https://skillmd.com/u/redisearch)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/redisearch/run-rust-benchmarks

---


# Rust Benchmarks Skill

Run Rust benchmarks and compare performance with the C implementation.

## Arguments
- `<crate>`: Run the given benchmark crate (e.g., `/run-rust-benchmarks rqe_iterators_bencher`)
- `<crate> <bench>`: Run specific bench in a benchmark crate (e.g., `/run-rust-benchmarks rqe_iterators_bencher "Iterator - InvertedIndex - Numeric - Read Dense"`)

Arguments provided: `$ARGUMENTS`

## Instructions

1. Check the arguments provided above:
   - If a crate name is provided, run benchmarks for that crate:
     ```bash
     cargo bench --manifest-path src/redisearch_rs/Cargo.toml -p <crate_name>
     ```
   - If both crate and bench name are provided, run the specific bench:
     ```bash
     cargo bench --manifest-path src/redisearch_rs/Cargo.toml -p <crate_name> <bench_name>
     ```
2. **Run benchmarks only once.** If the output is too large or truncated, extract the timing data from the saved output file rather than re-running the benchmarks.
3. Once the benchmarks are complete, generate a summary comparing the average run times between the Rust and C implementations.
4. Ask the user: "Would you like a copyable markdown version for your PR description?" If yes, re-emit the summary table inside a fenced ` ```markdown ` code block so it can be pasted directly.

## Common Benchmark Commands

```bash
# Bench given crate
cargo bench --manifest-path src/redisearch_rs/Cargo.toml -p rqe_iterators_bencher
cargo bench --manifest-path src/redisearch_rs/Cargo.toml -p inverted_index_bencher

# Run a specific benchmark
cargo bench --manifest-path src/redisearch_rs/Cargo.toml -p rqe_iterators_bencher "Iterator - InvertedIndex - Numeric - Read Dense"
```

