Skip to content

perf: speed up unit tests 63% by removing JAX from triangle tests#252

Merged
Jammy2211 merged 1 commit intomainfrom
feature/unit-test-profiling
Apr 6, 2026
Merged

perf: speed up unit tests 63% by removing JAX from triangle tests#252
Jammy2211 merged 1 commit intomainfrom
feature/unit-test-profiling

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

Profiled the full PyAutoArray test suite and applied targeted optimizations to reduce total test time from 33.9s to 12.5s (63% faster). The main bottleneck was JAX JIT compilation overhead in triangle unit tests — each unique array shape triggered a fresh compilation costing 0.5-1s.

Key changes:

  • Switched all triangle tests from JAX classes to numpy equivalents (ArrayTrianglesNp, CoordinateArrayTrianglesNp)
  • Removed pure-JAX test files already covered by integration tests in autolens_workspace_test
  • Reduced PSF weighted noise test mask from 51×51 to 21×21 (test validates two methods agree — smaller sizes still verify correctness)
  • Removed test_vertex_coordinates.py (contained only print statements, no assertions)

API Changes

None — internal test changes only.

Test Plan

  • Full test suite passes: 722 passed in 12.5s
  • No source code changes — only test files modified
  • CI passes on this branch
Full API Changes (for automation & release notes)

No public API changes. All modifications are confined to test files:

  • test_autoarray/structures/triangles/conftest.py
  • test_autoarray/structures/triangles/test_coordinate.py
  • test_autoarray/structures/triangles/test_area.py
  • test_autoarray/structures/triangles/test_extended_source.py
  • test_autoarray/inversion/inversion/imaging/test_inversion_imaging_util.py

Deleted files:

  • test_autoarray/structures/triangles/test_jax.py (covered by integration tests)
  • test_autoarray/structures/triangles/test_nan_triangles.py (JAX-specific NaN handling)
  • test_autoarray/structures/triangles/test_vertex_coordinates.py (no assertions)

🤖 Generated with Claude Code

…ucing test sizes

Switched all triangle unit tests from JAX classes (ArrayTriangles,
CoordinateArrayTriangles) to numpy equivalents (ArrayTrianglesNp,
CoordinateArrayTrianglesNp), eliminating ~10s of JAX JIT compilation
overhead. Removed pure-JAX test files covered by integration tests.
Reduced PSF weighted noise test mask from 51x51 to 21x21.

Total suite time: 33.9s → 12.5s (63% faster, 722 tests).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Jammy2211 Jammy2211 merged commit e27efb5 into main Apr 6, 2026
0 of 2 checks passed
@Jammy2211 Jammy2211 deleted the feature/unit-test-profiling branch April 6, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant