83 lines
3.7 KiB
Text
83 lines
3.7 KiB
Text
---
|
|
title: "Codeflash is an AI performance optimizer for your code"
|
|
icon: "rocket"
|
|
sidebarTitle: "Overview"
|
|
keywords: ["python", "javascript", "typescript", "performance", "optimization", "AI", "code analysis", "benchmarking"]
|
|
---
|
|
|
|
Codeflash speeds up your code by figuring out the best way to rewrite it while verifying that the behavior is unchanged, and verifying real speed
|
|
gains through performance benchmarking. It supports **Python**, **JavaScript**, and **TypeScript**.
|
|
|
|
The optimizations Codeflash finds are generally better algorithms, opportunities to remove wasteful compute, better logic, utilizing caching and utilization of more efficient library methods. Codeflash
|
|
does not modify the system architecture of your code, but it tries to find the most efficient implementation of your current architecture.
|
|
|
|
### Get Started
|
|
|
|
Pick your language to install and configure Codeflash:
|
|
|
|
<CardGroup cols={2}>
|
|
<Card title="Python" icon="python" href="/getting-started/local-installation">
|
|
Install via pip, uv, or poetry. Configure in `pyproject.toml`.
|
|
</Card>
|
|
<Card title="JavaScript / TypeScript" icon="js" href="/getting-started/javascript-installation">
|
|
Install via npm, yarn, pnpm, or bun. Configure in `package.json`. Supports Jest, Vitest, and Mocha.
|
|
</Card>
|
|
</CardGroup>
|
|
|
|
### How to use Codeflash
|
|
|
|
These commands work for both Python and JS/TS projects:
|
|
|
|
<CardGroup cols={2}>
|
|
<Card title="Optimize a Function" icon="bullseye" href="/optimizing-with-codeflash/one-function">
|
|
```bash
|
|
codeflash --file path/to/file --function my_function
|
|
```
|
|
</Card>
|
|
|
|
<Card title="Optimize Entire Codebase" icon="globe" href="/optimizing-with-codeflash/codeflash-all">
|
|
```bash
|
|
codeflash --all
|
|
```
|
|
</Card>
|
|
|
|
<Card title="Trace & Optimize Workflows" icon="route" href="/optimizing-with-codeflash/trace-and-optimize">
|
|
```bash
|
|
codeflash optimize myscript.py
|
|
```
|
|
</Card>
|
|
|
|
<Card title="Auto-Optimize Pull Requests" icon="code-pull-request" href="/optimizing-with-codeflash/codeflash-github-actions">
|
|
```bash
|
|
codeflash init-actions
|
|
```
|
|
</Card>
|
|
</CardGroup>
|
|
|
|
### Configuration Reference
|
|
|
|
<CardGroup cols={2}>
|
|
<Card title="Python Config" icon="python" href="/configuration/python">
|
|
`pyproject.toml` reference
|
|
</Card>
|
|
<Card title="JS / TS Config" icon="js" href="/configuration/javascript">
|
|
`package.json` reference — includes monorepo, scattered tests, manual setup
|
|
</Card>
|
|
</CardGroup>
|
|
|
|
### How does Codeflash verify correctness?
|
|
|
|
Codeflash verifies the correctness of the optimizations it finds by generating and running new regression tests, as well as any existing tests you may already have. Codeflash tries to ensure that your
|
|
code behaves the same way before and after the optimization.
|
|
This offers high confidence that the behavior of your code remains unchanged.
|
|
|
|
### Continuous Optimization
|
|
|
|
Because Codeflash is an automated process, the main way to use it is by installing it as a GitHub action and have it optimize the new code on every pull request.
|
|
When Codeflash finds an optimization, it will ask you to review it. It will write a detailed explanation of the changes it made, and include all relevant info like % speed increase and proofs of correctness.
|
|
|
|
This is a great way to ensure that your code, your team's code and your AI Agent's code are optimized for performance before it causes a performance regression. We call this *Continuous Optimization*.
|
|
|
|
## Questions or Feedback?
|
|
|
|
Your feedback will help us make codeflash better, faster. If you have any questions or feedback, use the Intercom button in the lower right, join our [Discord](https://www.codeflash.ai/discord), or drop us a note at [contact@codeflash.ai](mailto:contact@codeflash.ai) - we read every message!
|