|
1 | | -# CodeFlash Optimize-Me |
| 1 | +# ⚡ CodeFlash Optimize-Me |
| 2 | +**Ship fast code from day one.** This repo lets you experience the magic of AI-powered code optimization. |
2 | 3 |
|
3 | | -This repository contains code that can be optimized with Codeflash. The idea is that you can easily get started with Codeflash by optimizing this repository. |
| 4 | +## 🚀 What is this repo? |
4 | 5 |
|
5 | | -Fork this repo, clone it on your machine, then run Codeflash to see how it analyzes your code, suggests improvements, and integrates with your workflow through pull requests. |
| 6 | +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. |
6 | 7 |
|
7 | | -## What is Codeflash? |
| 8 | +## 🔍 What is Codeflash? |
8 | 9 |
|
9 | | -Codeflash is an automated AI based code performance optimizer that creates verified optimizations for your code. It improves performance, reduces resource usage, and enhances code efficiency. You can use it to optimize algorithms, speed up mathematical computations, optimize Pytorch, and make data handling more efficient with NumPy and Pandas. |
| 10 | +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. |
10 | 11 |
|
11 | | -## Getting Started |
| 12 | +**Codeflash can:** |
| 13 | +- Improve algorithms and data structures (like converting lists to sets) |
| 14 | +- Speed up mathematical operations with NumPy |
| 15 | +- Optimize machine learning code for PyTorch |
| 16 | +- Make data handling more efficient with Pandas |
| 17 | +- Catch and fix inefficient patterns automatically |
12 | 18 |
|
13 | | -The below is expected to take about 5 minutes. |
| 19 | +Leading engineering teams at [Pydantic](https://pydantic.dev/), [Langflow](https://langflow.org/), and [Roboflow](https://roboflow.com) trust Codeflash to ship expert-level, high-performance code. |
14 | 20 |
|
15 | | -- Fork this repo on your GitHub account. You can do it by clicking "Fork" on the top of this repo. This is required so that Codeflash can open Pull Requests with the optimizations it found on your fork. |
16 | | -- Clone the repo to your machine. Any machine works - laptops, PCs, virtual machines. |
| 21 | + |
| 22 | +## ⏱️ Getting Started ( 5 minutes) |
| 23 | + |
| 24 | +1. **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. |
| 25 | +2. **Clone your fork** to your local machine. |
17 | 26 |
|
18 | 27 | ```bash |
19 | | -git clone https://github.com/<your_github_account>/optimize-me.git |
| 28 | +git clone https://github.com/<your_github_username>/optimize-me.git |
20 | 29 | cd optimize-me |
21 | 30 | ``` |
22 | | -- Create a new Python virtual environment, and activate it. |
| 31 | +3. **Create a Python virtual environment, and activate it.** |
23 | 32 |
|
24 | | -With `venv` you can do |
| 33 | +Using `venv`: |
25 | 34 | ```bash |
26 | 35 | python -m venv .venv |
27 | 36 | source .venv/bin/activate |
28 | 37 | ``` |
29 | 38 |
|
30 | | -To use `conda` you can do |
| 39 | +Or with `conda`: |
31 | 40 | ```bash |
32 | | -conda create -n optimize-me |
| 41 | +conda create -n optimize-me python=3.12 |
33 | 42 | conda activate optimize-me |
34 | 43 | ``` |
35 | 44 |
|
36 | | -- Install Package dependencies |
| 45 | +4. **Install dependencies** |
37 | 46 | ```bash |
38 | 47 | pip install -r requirements.txt |
39 | 48 | ``` |
40 | 49 |
|
41 | | -## Set up Codeflash |
| 50 | +## 🔮 Set up Codeflash |
42 | 51 |
|
43 | | -You can now follow the quick guided setup by running - |
| 52 | +Run the guided setup: |
44 | 53 | ```bash |
45 | 54 | codeflash init |
46 | 55 | ``` |
47 | | -Since this project already has the codeflash settings pre-configured in pyproject.toml, it will only ask you to get a `CODEFLASH_API_KEY` by [signing up to Codeflash](https://app.codeflash.ai/login) and installing a GitHub App through [this link](https://github.com/apps/codeflash-ai/installations/select_target) |
| 56 | +Since this project already has the codeflash settings pre-configured in pyproject.toml, you will only need to: |
| 57 | +- Get a `CODEFLASH_API_KEY` by [signing up](https://app.codeflash.ai/login) |
| 58 | +- Install a GitHub App through [this link](https://github.com/apps/codeflash-ai/installations/select_target) |
48 | 59 |
|
49 | | -## Using CodeFlash |
| 60 | +## 💫 Using CodeFlash |
50 | 61 |
|
51 | | -- Optimize all the Python code in this repo by running |
| 62 | +**Optimize the entire repo:** |
52 | 63 |
|
53 | 64 | ```bash |
54 | 65 | codeflash --all |
55 | 66 | ``` |
56 | | -Codeflash will keep creating Pull Requests with optimizations for you as it keeps finding them. |
| 67 | +Codeflash will create Pull Requests with optimizations as it finds them. |
57 | 68 |
|
58 | | -- Optimize a single file |
| 69 | +**Optimize a single file** |
59 | 70 |
|
60 | 71 | ```bash |
61 | 72 | codeflash --file path/to/file |
62 | 73 | ``` |
63 | 74 |
|
64 | | -- Optimize a single function |
| 75 | +**Optimize a specific function:** |
65 | 76 |
|
66 | 77 | ```bash |
67 | 78 | codeflash --file path/to/file --function function_name |
68 | 79 | ``` |
69 | 80 |
|
70 | | -🪄 And just like that you've started on the journey of never shipping slow code again! |
| 81 | +## 🔥 What to expect |
| 82 | + |
| 83 | +Watch as Codeflash: |
| 84 | +1. Analyzes your code's intent |
| 85 | +2. Generates and runs test cases to understand behavior |
| 86 | +3. Proposes multiple optimization strategies |
| 87 | +4. Benchmarks each strategy for speed |
| 88 | +5. Verifies correctness with regression tests |
| 89 | +6. Creates a Pull Request with the fastest correct implementation |
| 90 | +7. Shows impressive speedups (up to 90x in some cases!) |
| 91 | + |
71 | 92 |
|
72 | | -## Need Help? |
| 93 | +## 🤝 Need Help? |
73 | 94 |
|
74 | | -The best way to ask for help is to join our [Discord community](https://www.codeflash.ai/discord) |
| 95 | +Join our [Discord community](https://www.codeflash.ai/discord) for support and to connect with other developers who love fast code. |
75 | 96 |
|
76 | 97 | ## Contributing |
77 | 98 |
|
78 | | -Please don't open Pull Requests on this repo with the optimizations you found. We want to keep this project unoptimized, so that people can optimize it in the future as well. |
| 99 | +**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. |
79 | 100 |
|
80 | 101 | Want to contribute? Here's how: |
81 | | - |
82 | 102 | 1. Fork the repository |
83 | 103 | 2. Create a new branch for your changes |
84 | 104 | 3. Add code that demonstrates CodeFlash's optimization capabilities |
85 | 105 | 4. Submit a pull request with a clear description of your changes |
86 | 106 |
|
87 | 107 | We welcome bug reports and feature requests through Github's issues system. |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +Never ship slow code again. Happy optimizing! ⚡ |
| 112 | + |
0 commit comments