> ## Documentation Index
> Fetch the complete documentation index at: https://codspeed.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Guides

> Step-by-step tutorials to help you benchmark your code and integrate performance testing into your workflow

Guides provide comprehensive, hands-on tutorials to help you implement
performance testing in your projects. Whether you're starting from scratch or
looking to deepen your benchmarking expertise, these guides walk you through
real-world scenarios with complete code examples.

> [!TIP]
>
> Looking for something specific? Ask questions and share feedback on
> [Discord](https://codspeed.io/discord)!

## How to Benchmark my Code?

These guides teach you the fundamentals of benchmarking in your language, from
writing your first benchmark to running them continuously in CI.

> [card] [How to Benchmark Python with pytest](https://codspeed.io/docs/guides/how-to-benchmark-python-with-pytest.md)
>
> Learn benchmarking from scratch with pytest-codspeed: write benchmarks with
> fixtures, parametrized tests, setup isolation, and integrate with CodSpeed
> for continuous performance testing.

> [card] [How to Benchmark Rust with divan](https://codspeed.io/docs/guides/how-to-benchmark-rust-with-divan.md)
>
> Learn benchmarking from scratch with divan: write benchmarks with arguments,
> type generics, dynamic inputs, and integrate with CodSpeed for continuous
> performance testing.

> [card] [How to Benchmark C++ with Google Benchmark](https://codspeed.io/docs/guides/how-to-benchmark-cpp-with-google-benchmark.md)
>
> Learn benchmarking from scratch with google\_benchmark: write benchmarks with
> arguments, fixtures, and integrate with CodSpeed for continuous performance
> testing.

> [card] [How to Benchmark Java with JMH](https://codspeed.io/docs/guides/how-to-benchmark-java-with-jmh.md)
>
> Learn benchmarking from scratch with JMH: project setup with Maven and
> Gradle, parameterized benchmarks, JVM pitfalls, profilers, and CodSpeed CI
> integration.

> [card] [How to Benchmark Go with the testing Package](https://codspeed.io/docs/guides/how-to-benchmark-go-with-testing.md)
>
> Learn benchmarking from scratch with Go's standard library: sub-benchmarks,
> parallel benchmarks, benchstat, pprof profiling, and CodSpeed CI
> integration.

## Benchmarking in CI

These guides set up CodSpeed in GitHub Actions for benchmarks you already have.

> [card] [Continuous Benchmarking for Rust in CI](https://codspeed.io/docs/guides/rust-continuous-benchmarking-in-ci.md)
>
> Run criterion or divan benchmarks with `cargo codspeed` and the CPU
> simulation instrument on a standard GitHub runner.

> [card] [Detect Go Benchmark Regressions in CI](https://codspeed.io/docs/guides/go-benchmark-regressions-in-ci.md)
>
> Run `go test` benchmarks with the walltime instrument on a Macro Runner.

## Specialized Guides

Guides organized by topic, covering benchmarking strategies, API testing,
database performance, and framework-specific integrations.

### Benchmarking Strategy & Tools

> [card] [Choosing the Right Python Benchmarking Strategy](https://codspeed.io/docs/guides/choosing-the-correct-python-benchmarking-strategy.md)
>
> Compare different Python benchmarking approaches, from command-line tools
> like `time` and `hyperfine` to integrated frameworks like `timeit` and
> `pytest-codspeed`.

### API Performance Testing

> [card] [Benchmarking a Go Gin API](https://codspeed.io/docs/guides/benchmarking-a-go-gin-api.md)
>
> Build a Gin HTTP API, write clean benchmarks for all routes, optimize
> measurement accuracy, and catch performance regressions in CI with
> flamegraph analysis.

### Database Performance Testing

Advanced tutorials for benchmarking applications with database interactions,
including setup strategies and CI integration.

> [card] [NestJS + MongoDB with Vitest](https://codspeed.io/docs/instruments/databases/mongodb/nodejs/vitest.md)
>
> Benchmark a NestJS API with MongoDB using Vitest benchmarks. Includes Docker and testcontainers setup patterns.

> [card] [NestJS + MongoDB with tinybench](https://codspeed.io/docs/instruments/databases/mongodb/nodejs/tinybench.md)
>
> Alternative approach using tinybench for MongoDB performance testing in Node.js applications.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.