Open kanpov opened 1 month ago
I guess it would be reasonable to investigate what gets included to the release binary. Yet no matter of using vendored
feature flag or not the Swagger UI files will anyways be included to the final binary. Vendored will just use prepackaged Swagger UI. Without vendoring the Swagger UI will be downloaded build time and embedded to the binary.
It just might be that the Swagger UI is that big. It actually contains a bunch of files. If want something more lightweight you should try scalar or rapidoc or redoc (redoc does not allow executing those paths from the UI).
I think it'd be reasonable to add a PSA about binary size to the doc page of utoipa-swagger-ui. I might give you exact figures on the binary size increase (but the ~12-13MB increase approximation is pretty accurate for my own project) later with an empty project.
Uncompressed, Swagger UI is ~17MB. Compressed, it's ~4.5MB. So I guess something like UPX should do the job on the final binary.
But UPX does not work on my specific binary...
Update: my local build was linked with mold
. Without mold
, upx
runs as expected and shrinks the binary by up to 75%. The compression is most likely very efficient on the Swagger UI assets.
Sure, we could add heads up notification to README.md of utoipa-swagger-ui
crate to inform potential users that Swagger UI needs some space.
Sure, we could add heads up notification to README.md of utoipa-swagger-ui crate to inform potential users that Swagger UI needs some space.
Or we could compress the Swagger UI assets in the binary. There are some crates to do that.
Version of utoipa-swagger-ui: 7.1.1-beta.0
Vendored feature is not enabled, including the package increases the release binary by ~12MB. Is this intended behavior?