Skip to content

HabitaNexus/monorepo / skills/system-reliability-engineering/load-testing-performance

load-testing-performance

Unverified

scripts/rust/benches/my_benchmark.rs

View on GitHub
//! Performance benchmarks for API request processing
//!
//! Usage:
//!   cargo bench
//!   cargo bench -- --profile-time=10

use criterion::{black_box, criterion_group, criterion_main, Criterion};

// Example function to benchmark
// Replace with your actual function
fn process_request(data: &str) -> String {
    // Simulate request processing
    format!("processed: {}", data)
}

fn benchmark_requests(c: &mut Criterion) {
    let mut group = c.benchmark_group("api_requests");

    // Configure benchmark settings
    group.sample_size(100);
    group.measurement_time(std::time::Duration::from_secs(10));

    group.bench_function("process_request", |b| {
        b.iter(|| {
            process_request(black_box("test_data"));
        });
    });

    group.bench_function("process_request_large", |b| {
        let large_data = "x".repeat(10000);
        b.iter(|| {
            process_request(black_box(&large_data));
        });
    });

    group.finish();
}

criterion_group!(benches, benchmark_requests);
criterion_main!(benches);
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall