codeflash/docs/getting-the-best-out-of-codeflash.mdx

36 lines
2.6 KiB
Text
Raw Permalink Normal View History

2025-02-13 06:26:19 +00:00
---
2025-07-31 02:50:51 +00:00
title: "Getting the Best Out of Codeflash"
description: "Tips, recommendations, and best practices for maximizing Codeflash's optimization capabilities"
icon: "lightbulb"
sidebarTitle: "Best Practices"
keywords: ["best practices", "tips", "github actions", "tracer", "optimization", "workflow"]
2025-02-13 06:26:19 +00:00
---
Codeflash is a powerful tool; here are our recommendations based on how the Codeflash team and our customers use Codeflash.
2025-02-13 06:26:19 +00:00
### Install the GitHub App and actions workflow
2025-02-13 06:26:19 +00:00
After you install Codeflash on an actively developed project, [installing the GitHub Actions](optimizing-with-codeflash/codeflash-github-actions) will automatically optimize your code whenever new pull requests are opened. This ensures you get the best version of any changes you make to your code without any extra effort. We find that PRs are also the best time to review these changes, because the code is fresh in your mind.
2025-02-13 06:26:19 +00:00
### Find and optimize entire scripts with the Codeflash Tracer
Find the best results by running [Codeflash Optimize](optimizing-with-codeflash/trace-and-optimize) on your script to optimize it.
This internally runs a profiler, captures inputs to all the functions your script calls, and uses those inputs to create Replay tests and benchmarks.
The optimizations you get with this method, show you how much faster your workflow will get plus guarantee that your workflow won't break if you merge in the optimizations.
2025-02-13 06:26:19 +00:00
### Find optimizations on your whole codebase with `codeflash --all`
If you have a lot of existing code, run [`codeflash --all`](optimizing-with-codeflash/codeflash-all) to discover and fix any
slow code in your project. Codeflash will open new pull requests for any optimizations it finds, and you can review and merge them at your own pace.
It is first recommended to trace your tests to achieve higher quality optimizations with this approach
```bash
codeflash optimize --trace-only -m pytest tests/ ; codeflash --all
```
2025-02-13 06:26:19 +00:00
### Review the PRs Codeflash opens
We're constantly improving Codeflash and the underlying AI models it uses. The state of the art changes weekly, and you can be confident the optimizer will always use the best performing LLMs to find optimizations for your code. That said, because Codeflash uses generative AI, it's still possible that the optimized code may actually have different behavior than the original code under certain conditions. Please review all the PRs that Codeflash opens to ensure that the optimized code is correct, just as you would review any other PR opened by a team member. And don't forget to send us feedback on how we can improve Codeflash - we're always listening!