home / skills / redisearch / redisearch / run-rust-benchmarks
This skill runs Rust benchmarks and compares performance against the C implementation to help optimize the Redisearch Rust integration.
npx playbooks add skill redisearch/redisearch --skill run-rust-benchmarksReview the files below or copy the command above to add this skill to your agents.
---
name: run-rust-benchmarks
description: Run Rust benchmarks and compare performance with the C implementation
---
# 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 benchmakr 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
cd src/redisearch_rs && cargo bench -p <crate_name>
```
- If both crate and bench name are provided, run the specific bench:
```bash
cd src/redisearch_rs && cargo bench -p <crate_name> <bench_name>
```
2. Once the benchmarks are complete, generate a summary comparing the average run times between the Rust and C implementations.
## Common Benchmark Commands
```bash
# Bench given crate
cd src/redisearch_rs && cargo bench -p rqe_iterators_bencher
cd src/redisearch_rs && cargo bench -p inverted_index_bencher
# Run a specific benchmark
cd src/redisearch_rs && cargo bench -p rqe_iterators_bencher "Iterator - InvertedIndex - Numeric - Read Dense"
```
This skill runs Rust benchmark crates for the query and indexing engine and produces a concise comparison against the C implementation. It automates executing cargo benchmarks for a chosen crate or a specific bench and summarizes average run-time differences. The output focuses on clear performance deltas useful for optimization decisions.
The skill changes to the Rust workspace and invokes cargo bench for the specified crate or for a single benchmark within that crate. After the bench completes, it extracts average run times and compares them to the recorded C implementation results, producing a side-by-side summary of performance differences. The summary highlights regressions, improvements, and percent change.
What command runs a crate benchmark?
Change into the Rust workspace and run: cd src/redisearch_rs && cargo bench -p <crate_name>.
How do I run a single benchmark within a crate?
Run the crate with the bench name quoted: cd src/redisearch_rs && cargo bench -p <crate_name> "<bench_name>".