Skip to content

feat: add tight_layout wrapper with PYAUTO_FAST_PLOTS env var#254

Merged
Jammy2211 merged 1 commit intomainfrom
feature/fast-plots-tight-layout
Apr 7, 2026
Merged

feat: add tight_layout wrapper with PYAUTO_FAST_PLOTS env var#254
Jammy2211 merged 1 commit intomainfrom
feature/fast-plots-tight-layout

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

  • Add tight_layout() wrapper in autoarray/plot/utils.py that skips plt.tight_layout() when PYAUTO_FAST_PLOTS=1
  • Replace all 10 plt.tight_layout() call sites across 6 plot files with the wrapper
  • Export tight_layout from autoarray.plot

Motivation

Profiling showed plt.tight_layout() is the #1 plotting bottleneck in smoke tests — ~0.5-1s per subplot figure due to matplotlib font discovery and text metrics. Skipping it saves ~3.5s per script while preserving full code coverage.

Test plan

  • All 722 PyAutoArray tests pass
  • Verified imaging/simulator.py drops from 12.4s to 5.4s with PYAUTO_FAST_PLOTS=1
  • Verified normal behavior unchanged without the env var

🤖 Generated with Claude Code

When PYAUTO_FAST_PLOTS=1, skip plt.tight_layout() in all subplot
functions. This avoids expensive matplotlib font discovery and text
metrics computation (~0.5-1s per subplot figure), cutting smoke test
times significantly while preserving full code coverage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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