Canonical: https://botbento.com/usecases/loop-code-optimization-with-testable-performance-hypotheses/
Format: Markdown representation of the public HTML page.

# Loop code optimization with testable performance hypotheses

[Coding](https://botbento.com/usecases/coding/) · Advanced

Profile, hypothesize, patch and benchmark until a change proves faster

Runs a repeating optimization loop over a repository: measure a baseline, state a hypothesis about a change that should cut runtime, implement it on a branch, benchmark it, and keep or discard the patch based on measured evidence. Every attempt and its diff is logged so later rounds build on earlier findings, and a periodic report summarizes progress and individual patches.

## Quick answers

**What does it do?** Profile, hypothesize, patch and benchmark until a change proves faster. Result: Performance report with patch diffs.

**What does it need?** Tools: GitHub, Terminal, PDF files, Docs. Advanced: more tools and setup. The prompt includes an approval step.

**How do I run it?** On a schedule: Optimization round. Copy the prompt below into a bot in BotBento.

## How it works

1. On a schedule: Optimization round
2. Then: Profile, hypothesize, patch, benchmark
3. Result: Performance report with patch diffs

## Prompt to start with

```text
You optimize a code repository through repeated falsifiable experiments. Start by building a performance profile of the target workload and recording baseline timings. Then propose one hypothesis about a change that should reduce runtime, implement it on a separate branch, and run the benchmark suite against the baseline. Keep the change only if measurements improve and the existing tests pass; otherwise revert it and record why it failed. Log every attempt, result and diff in the knowledge base so later hypotheses build on what was already learned. Ask the user to confirm test thresholds before evaluating. Never merge branches, delete anything, or publish reports without explicit approval.
```

## Tools it uses

GitHub, Terminal, PDF files, Docs

## Works with

BotBento

## Tags

optimization, benchmarking, experiments, version-control, performance

## Source

[Show HN: An agent skill that optimizes code with falsifiable hypotheses](https://news.ycombinator.com/item?id=50611593) — Hacker News · checked 2026-11-26

Summarized in our own words. Any results described there are the authors’ own, not measured by BotBento.

Verified 2026-11-29: passed every automated gate and a second-model review (grok-bot). Automated, not human review. [How verification works](https://botbento.com/usecases/verification/)

By BotBento Editorial · Added 2026-11-29 · Updated 2026-11-29 · [Suggest a correction](https://botbento.com/contact/)

## Related use cases

- [Iterate on CUDA kernels using benchmark and profiler feedback](https://botbento.com/usecases/iterate-on-cuda-kernels-using-benchmark-and/) — Proposes faster kernel variants and checks they still pass.
- [Refactoring code to satisfy strict size constraints](https://botbento.com/usecases/refactoring-code-to-satisfy-strict-size-constraints/) — Analyze code to reduce binary footprint while preserving logic and competitive performance.
- [Front-end code quality and accessibility auditor](https://botbento.com/usecases/front-end-code-quality-and-accessibility-auditor/) — Audit pull requests against modern web standards, accessibility rules, and performance practices
