Target and optimize individual Python functions for maximum performance gains
Codeflash is essentially a function optimizer. When asked to optimize a function, Codeflash will analyze the function,
any helper functions it calls, and the imports it uses. It will then generate multiple new versions of the function and its helper functions, that are
optimized for efficiency and performance while being functionally equivalent to the original function.Codeflash tests if a function is optimized by running the function and comparing the output of the new function to
the original function. If the outputs match and the runtime of the new function is smaller, then the function is considered optimized.
Codeflash works best on pure functions that donβt have side effects. It can also optimize functions with side effects, but
your mileage may vary.
If you have installed the GitHub App to your repository, the above command will open a pull request with the optimized function.
If you want to optimize a function locally, you can add a --no-pr argument as follows: