Skip to content

Conversation

@Erotemic
Copy link
Member

Motivation

  • Introduce an experimental AST-based optimizer that can be evaluated alongside the existing legacy optimizer without changing public behavior.
  • Provide a separate entrypoint so both optimizers can coexist for comparison and iterative rule development.

Description

  • Added a new experimental submodule delayed_image.experimental.astopt with driver, rule registry, traversal helpers, and canonical-signature helpers (optimizer.py, rules.py, transformer.py, signature.py, plus package __init__.py).
  • Exposed new entrypoints: delayed_image.experimental.astopt.optimize() and optimize_trace(), and added DelayedOperation.optimize_ast() (and .pyi stub) which forwards to the experimental optimizer; the existing optimize() behavior is unchanged.
  • Tests: added tests/conftest.py with fixtures to parametrize between the legacy and AST optimizer, added equivalence/idempotence tests in tests/test_ast_optimize_equivalence.py, and updated several existing tests to run against both optimizer callables.
  • Documentation: added an Unreleased changelog entry describing the experimental optimizer and how to invoke it (CHANGELOG.md).

Testing

  • Ran the full test suite via the project test driver (python run_tests.py, which runs pytest plus xdoctest); the run collected 184 items and produced a mixed result: 113 passed, 19 failed, 52 skipped, and 2 warnings.
  • The new AST equivalence/idempotence tests (tests/test_ast_optimize_equivalence.py) passed in the test runs that exercised them, and the paramaterized tests exercised both optimize() and optimize_ast() paths.
  • Remaining failures are mostly environment/backend related (examples: NotImplementedError from kwimage.warp_affine because the skimage backend is not available in this environment, and xdoctest failures caused by blocked external demo image downloads); these are pre-existing environment-sensitive failures rather than regressions in the new optimizer integration.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant