Coding super-intelligence to find the most optimized Python code. Use it to optimize existing codebases or new Pull requests as a GitHub Action or a VS Code Extension.
Find a file
Mohamed Ashraf 1a5198f7ee fix: java timing markers now include test names for per-test filtering
Previously, timing markers from all tests were being processed for every
individual test case when using direct JVM execution (bypassing Maven).
This caused incorrect benchmark calculations and 'benchmark sum = 0' errors.

The fix adds test method names to timing markers at instrumentation time
(compile-time constants) rather than attempting runtime extraction via
stack traces. This follows Python's proven approach and ensures each test
only processes its own timing markers.

Changes:
- Add _extract_test_method_name() to parse test names from method signatures
- Include test name as compile-time constant in instrumented code
- Update timing marker format to include test name as 6th field
- Maintain backward compatibility with old 5-field marker format
- Update test expectations to include test names in markers

This resolves the critical bug preventing accurate per-test performance
measurement in the Java optimization pipeline.
2026-02-20 00:59:05 +00:00
.github/workflows add JDK for windows 2026-02-18 03:57:09 +02:00
code_to_optimize fix: force Maven fallback for benchmarking until direct JVM XML generation is fixed 2026-02-20 00:59:05 +00:00
codeflash fix: java timing markers now include test names for per-test filtering 2026-02-20 00:59:05 +00:00
codeflash-benchmark cond addopts 2025-08-24 01:59:48 -05:00
codeflash-java-runtime fix pom.xml 2026-02-10 20:27:54 +02:00
docs e2e working java 2026-01-30 10:52:45 -08:00
experiments fix: lint issues in experiments folder and format fixes 2026-01-29 19:26:50 +05:30
packages/codeflash Merge branch 'main' into fix/jest-xml-path-resolution-monorepo 2026-02-03 20:00:10 +05:30
tests fix: java timing markers now include test names for per-test filtering 2026-02-20 00:59:05 +00:00
.gitignore fix: add API key for tests and build codeflash-runtime JAR in CI 2026-02-03 02:18:49 +00:00
.pre-commit-config.yaml update versions 2026-02-03 17:17:57 -05:00
CLAUDE.md chore: add tool permissions to Claude workflow and strengthen CLAUDE.md guidelines 2026-02-03 16:59:28 -05:00
codeflash.code-workspace improve codeflash debugging 2025-06-26 15:00:35 -07:00
MULTI_LANGUAGE_ARCHITECTURE.md wip instrumentation and execution 2026-01-15 12:13:37 -08:00
mypy_allowlist.txt rename file name 2025-06-05 20:08:09 -07:00
pyproject.toml Merge branch 'main' into omni-java 2026-02-04 03:22:37 -05:00
README.md release/v0.17.0 (#756) 2025-09-23 14:02:30 -07:00
SECURITY.md Create SECURITY.md 2025-08-06 18:50:57 -07:00
uv.lock Merge branch 'main' into omni-java 2026-02-04 03:22:37 -05:00

Codeflash-banner

GitHub commit activity PyPI Downloads PyPI Downloads

Codeflash is a general purpose optimizer for Python that helps you improve the performance of your Python code while maintaining its correctness. It uses advanced LLMs to generate multiple optimization ideas for your code, tests them to be correct and benchmarks them for performance. It then creates merge-ready pull requests containing the best optimization found, which you can review and merge.

How to use Codeflash -

  • Optimize an entire existing codebase by running codeflash --all
  • Automate optimizing all future code you will write by installing Codeflash as a GitHub action.
  • Optimize a Python workflow python myscript.py end-to-end by running codeflash optimize myscript.py

Codeflash is used by top engineering teams at Pydantic (PRs Merged), Roboflow (PRs Merged 1, PRs Merged 2), Unstructured (PRs Merged 1, PRs Merged 2), Langflow (PRs Merged) and many others to ship performant, expert level code.

Codeflash is great at optimizing AI Agents, Computer Vision algorithms, PyTorch code, numerical code, backend code or anything else you might write with Python.

Installation

To install Codeflash, run:

pip install codeflash

Add codeflash as a development time dependency if you are using package managers like uv or poetry.

Quick Start

  1. To configure Codeflash for a project, at the root directory of your project where the pyproject.toml file is located, run:

    codeflash init
    
    • It will ask you a few questions about your project like the location of your code and tests
    • Ask you to generate an API Key to access Codeflash's LLMs
    • Install a GitHub app to open Pull Requests on GitHub.
    • Ask if you want to setup a GitHub actions which will optimize all your future code.
    • The codeflash config is then saved in the pyproject.toml file.
  2. Optimize your entire codebase:

    codeflash --all
    

    This can take a while to run for a large codebase, but it will keep opening PRs as it finds optimizations.

  3. Optimize a script:

    codeflash optimize myscript.py
    

Documentation

For detailed installation and usage instructions, visit our documentation at docs.codeflash.ai

Demo

  • Optimizing the performance of new code for a Pull Request through GitHub Actions. This lets you ship code quickly while ensuring it remains performant.

https://github.com/user-attachments/assets/38f44f4e-be1c-4f84-8db9-63d5ee3e61e5

  • Optiming a workflow end to end automatically with codeflash optimize

https://github.com/user-attachments/assets/355ba295-eb5a-453a-8968-7fb35c70d16c

Support

Join our community for support and discussions. If you have any questions, feel free to reach out to us using one of the following methods:

License

Codeflash is licensed under the BSL-1.1 License. See the LICENSE file for details.