Run image decoding and resizing off the event loop #75

Merged
ryan merged 1 commits from perf/offload-image-processing into main 2026-10-12 23:06:41 -04:00
Owner

process_image takes ~560ms on a 12MP photo (measured) and image_content_block decodes with PIL; both ran synchronously in async handlers and froze all concurrent chat streams. Now run via asyncio.to_thread in the upload handlers, the chat stream, and iMessage.

Tests: new test asserts process_image runs off the main thread. Full suite passes.

🤖 Generated with Claude Code

process_image takes ~560ms on a 12MP photo (measured) and image_content_block decodes with PIL; both ran synchronously in async handlers and froze all concurrent chat streams. Now run via asyncio.to_thread in the upload handlers, the chat stream, and iMessage. Tests: new test asserts process_image runs off the main thread. Full suite passes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ryan added 1 commit 2026-10-12 23:02:54 -04:00
process_image takes ~560ms on a 12MP photo and image_content_block
decodes HEIC/JPEG with PIL; both ran synchronously inside async
handlers, freezing every concurrent chat stream. Run them via
asyncio.to_thread in the upload handlers, the chat stream, and iMessage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ryan merged commit 24f6764c64 into main 2026-10-12 23:06:41 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ryan/simbarag#75