---
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"]
---

Codeflash is a powerful tool; here are our recommendations based on how the Codeflash team and our customers use Codeflash.

### Install the GitHub App and actions workflow

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.

### 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.


### 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
```


### 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!