Ship fast code from day one. This repo lets you experience the magic of AI-powered code optimization.
This repository contains intentionally unoptimized Python code that's perfect for experiencing Codeflash in action. Fork it, run Codeflash, and watch as it automatically discovers optimizations and opens Pull Requests while verifying the optimized code works exactly the same as the original.
Codeflash is an AI-powered code optimizer that automatically finds the most performant version of your Python code through intelligent benchmarking—while verifying it's still correct. It's like having an expert performance engineer review and optimize every line of your code.
Codeflash can:
- Improve algorithms and data structures (like converting lists to sets)
- Speed up mathematical operations with NumPy
- Optimize machine learning code for PyTorch
- Make data handling more efficient with Pandas
- Catch and fix inefficient patterns automatically
Leading engineering teams at Pydantic, Langflow, and Roboflow trust Codeflash to ship expert-level, high-performance code.
- Fork this repo to your GitHub account by clicking "Fork" on the top of the page. This allows Codeflash to open Pull Requests with the optimizations it found on your forked repo.
- Clone your fork to your local machine.
git clone https://github.com/<your_github_username>/optimize-me.git
cd optimize-me
- Create a Python virtual environment, and activate it.
Using venv
:
python -m venv .venv
source .venv/bin/activate
Or with conda
:
conda create -n optimize-me python=3.12
conda activate optimize-me
- Install dependencies
pip install -r requirements.txt
Run the guided setup:
codeflash init
Since this project already has the codeflash settings pre-configured in pyproject.toml, you will only need to:
- Get a
CODEFLASH_API_KEY
by signing up - Install a GitHub App through this link
Optimize the entire repo:
codeflash --all
Codeflash will create Pull Requests with optimizations as it finds them.
Optimize a single file
codeflash --file path/to/file
Optimize a specific function:
codeflash --file path/to/file --function function_name
Watch as Codeflash:
- Analyzes your code's intent
- Generates and runs test cases to understand behavior
- Proposes multiple optimization strategies
- Benchmarks each strategy for speed
- Verifies correctness with regression tests
- Creates a Pull Request with the fastest correct implementation
- Shows impressive speedups (up to 90x in some cases!)
Join our Discord community for support and to connect with other developers who love fast code.
Please don't open Pull Requests on this repo with the optimizations you found. We want to keep this project unoptimized for future users to experience Codeflash.
Want to contribute? Here's how:
- Fork the repository
- Create a new branch for your changes
- Add code that demonstrates CodeFlash's optimization capabilities
- Submit a pull request with a clear description of your changes
We welcome bug reports and feature requests through Github's issues system.
Never ship slow code again. Happy optimizing! ⚡