framesurge / perseus

A state-driven web development framework for Rust with full support for server-side rendering and static generation.
https://framesurge.sh/perseus/en-US
MIT License
2.15k stars 89 forks source link

Engine Brotli compressed and optional http servers compression #300

Closed JT117 closed 9 months ago

JT117 commented 1 year ago

Relates to #199

Goal 1: Serve brotli pre compressed perseus engine files

Result :

On the basic example: Mode File raw kB brotli kB
serve bundle.js 42.42 6.5
bundle.wasm 2980 554.71
deploy bundle.js 32.43 5.23
bundle.wasm 315.98 109.62

The lighthouse score on mobile goes up from 97% to 100% On my app it goes from 89% to 100% on mobile.

Remarks: Each server has it's own way to do thing, it goes from simple to I had to make a new Responder for Rocket

Goal 2: Add the possibility for users to enable http compression on the servers

Result:

On the basic example:

Server File raw (kB) compressed (kB) Type
rocket index 1.010 0.638 brotli
about 0.927 0.328 brotli
warp index 1.010 0.657 gzip
about 0.927 0.611 gzip
actix-web index 1.010 0.694 gzip
about 0.927 0.647 gzip
axum index 1.010 0.657 gzip
about 0.927 0.610 gzip

I would be happy to discuss the changes 😄 , and explain the choices that I made

JT117 commented 11 months ago

Thanks for the feedback :) I'm on it, I will look again at rocket to see if I missed something, compress only the js and wasm bundle, change the flag name to disable_bundle_compression and accept all the corrections you made

arctic-hen7 commented 10 months ago

I've just resolved a tiny conflict (Git being very silly), and, once tests are passing, this should be good to merge! Thanks again!