Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doc for compresslevel of the GZipMiddleware and use compresslevel=5 in the example #11412

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

RaphaelMarinier
Copy link

@RaphaelMarinier RaphaelMarinier commented Apr 5, 2024

compresslevel is defined there in starlette's GZipMiddleware:
https://github.com/encode/starlette/blob/4e453ce91940cc7c995e6c728e3fdf341c039056/starlette/middleware/gzip.py#L30

compresslevel=5 is typically a better CPU / compression level tradeoff than 9, e.g. see:
https://tukaani.org/lzma/benchmarks.html

@tiangolo
Copy link
Owner

tiangolo commented Apr 5, 2024

📝 Docs preview for commit 1ba7288 at: https://12056547.fastapitiangolo.pages.dev

@alejsdev alejsdev added the docs Documentation about how to use FastAPI label Apr 5, 2024
@soulee-dev
Copy link

Seems like it's duplicated PR #11350

@RaphaelMarinier
Copy link
Author

Indeed, it's mostly a duplicate (I was not aware of it), except that the default I propose in the doc is probably a better tradeoff (typically 3x less CPU usage, for only one percent point larger outputs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation about how to use FastAPI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants