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
Feature: Add ahead of time compression of the static files for x86_64 #4390
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #4390 +/- ##
=======================================
Coverage 95.89% 95.90%
=======================================
Files 359 359
Lines 13706 13709 +3
Branches 1094 1094
=======================================
+ Hits 13144 13147 +3
Misses 558 558
Partials 4 4
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
d362780
to
55d9006
Compare
This seems useful (and patching PRs into other OSS projects seems to be a theme lately...), but pardon my ignorance in trying to test this out:
Also, just curious if this change requires the css map to be added or did you just not like seeing the error log =)? No problem with that obv, just curious |
|
Very curiously different than what I recall seeing. I'll have to look again when I can. I recall Now I'm curious about this. |
Yea my domain is behind CF and Traefik so at first I was like "oh duh, its those" but I dont understand who/what/how/why is doing it over localhost (not https either). This stuff is really opaque to me 🤔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blah, sorry my bad, I think just user error on my part.
Thanks for the PR
72f420a
to
252806a
Compare
Alright, this should be the final form. I ended up finding some other improvements with the image here, so the resulting image actually shrinks, despite adding more files (in the form of the compressed files). So the new flow of data is something like this:
|
Appreciate the explanation. I do mostly understand the flow and overall goal but code is still mostly Greek to me. I think at this point you've earned trust with the project to do as you see fit. For my part, can confirm working from an end-user perspective. Thanks stumpy |
6470cfe
to
83a6799
Compare
Weird, not sure why this keeps getting stuck. That's at least twice now, at different times in the build. I may have to go back to the simpler method |
83a6799
to
2ec080a
Compare
Alright, I ended up going back to the simple method which doesn't add much time at all to the build. Even with the attempts earlier, the ARM64 build seemed to be taking longer and getting stuck in weird ways. The 1hr+ to compress the files under emulation just isn't worth it. Our ARM64 users can still get the on-the-fly compression from the middleware. Once this finishes building and I double check it on both platforms, I'll merge this one and be done |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion or issue for related concerns. |
Proposed change
This PR adds compression of the static files, using whitenoise. The static files are compressed once, on x86_64, then used throughout.
I considered making it more configurable, but then I think it would be easy for a user to change this and not run
collectstatic
, leaving them with no or wrong static files in place. Or a "release" vs "development" build, but that proved to become complicated quickly.Perhaps in the future GitHub will have native arm64 runners, which would allow this to be revisited and simplified. Some improvements to whitenoise could be built in as well.
In some testing, this reduced main.js to about 50% size when using gzip and to about 40% size when using Brotli (requires HTTPs).
Type of change
Checklist:
pre-commit
hooks, see documentation.