feat(opencode): gzip compress json responses for up to 97% smaller payload#11378
feat(opencode): gzip compress json responses for up to 97% smaller payload#11378brittlewis12 wants to merge 1 commit intoanomalyco:devfrom
Conversation
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
but it does have a linked issue? #10475 |
…nse for 97% smaller payload
…nse for 97% smaller payload
|
took a quick pass over other potentially desirable candidates for response gzip compression — i think the main ones that stood out were if you folks would like i’m happy to extend this to those as well, but i figured i’d stick with the pain i’ve actually felt! edit: just implemented for all json responses |
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
…nse for 97% smaller payload
Compresses JSON responses > 1KB when client sends Accept-Encoding: gzip. Reduces /provider from 1.7MB to 102KB, /config from 13KB to 5KB, etc.
20e56a4 to
a599cf2
Compare
|
Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
What does this PR do?
fixes #10475
Large sessions can have 20MB+ JSON payloads which can take 20-30s to transfer over mobile networks. Gzip compression reduces this dramatically, improving mobile load times perceptibly. In one case a 400-message session went from 20-30s (23.9MB) to ~5s (580KB).
I attempted to use hono’s own compression middleware but that seemed to break the client, so I opted to implement a middleware with bun’s gzip compression directly.
How did you verify your code works?
ran the server locally (
bun run dev web) and tested a session w 400 messages on my phone against v1.1.47:before (v1.1.47)
custom client logging:
23.9MB for that one session:
after (this PR)
custom client logging:
23.9MB -> 580KB for that one session