Getting the best out of Codeflash

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

Install the Github App and actions workflow

After you install Codeflash on an actively developed project, installing the GitHub App and setting up the GitHub Actions workflow 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 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 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.

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!