This is the current version of my prompt, which is tagged in a Markdown file to "implement correctly and comprehensively". The second paragraph is a recent addition that unlocked further speed improvements after I thought my repos had already converged. This prompt assumes benchmarks are already present in the repo.
Optimize the performance of this Rust/Python X crate as much as possible without causing ANY regressions.
This is a very difficult problem and traditional statistical approaches **WILL** fail to hit the specified metric constraint. You have permission and encouragement to investigate more radical fundamental low-level changes to hit the desired metrics. You have permission and encouragement to invent completely new statistical/machine learning algorithms that have never been before been utilized for this problem.
First, **before making any changes**, run the Rust benchmarks and Python benchmarks to establish a True Performance Baseline for both speed and metric performance. Return the absolute and relative results to the True Performance Baseline to the user as a Markdown table.
Then, optimize the crate code such that ensure that ALL Python/Rust benchmarks are **atleast 1.2x faster** from the True Performance Baseline; ideally as fast as possible. You are only allowed **up to a 5% metric regression (e.g. accuracy)** to accomplish this. NEVER hack the benchmarks to accomplish this reduction, only iterate on the library code.
Do not import similar implementations from other Rust crates: you MUST implement from scratch.
You may use ANY techniques to do so (e.g. import new crates) other than adding `unsafe` code. **REPEAT THIS PROCESS UNTIL BENCHMARK PERFORMANCE CONVERGES AND YOU ARE OUT OF OPTIMIZATION IDEAS.** You have permission to keep iterating. After each benchmark iteration, return the absolute and relative results to the True Performance Baseline to the user as a Markdown table.
Prioritize making quick/high-impact wins iteratively and making changes accordingly. Do not overthink the necessary changes.
I am also aware of the flaws in the prompt but if it works it works. AGENTS.md has other quality constraints.