Running offline compression is slow (python -m jac.contrib.flask my_flask_module:create_app). This change uses an in-memory hash to prevent re-compressing the same file more than once. If templates share common script files, this can speed up the offline compression step:
Before
time python -m jac.contrib.flask test:app
Deleting previously compressed files in /Users/alan/projects/test/test/static/sdist
Compressing static assets into /Users/alan/projects/test/test/static/sdist
Finished offline-compressing static assets.
real 4m23.766s
user 5m4.898s
sys 0m30.058s
After
time python -m jac.contrib.flask test:app
Deleting previously compressed files in /Users/alan/projects/test/test/static/sdist
Compressing static assets into /Users/alan/projects/test/test/static/sdist
Finished offline-compressing static assets.
real 1m37.951s
user 1m38.567s
sys 0m13.137s
Time saved: 2m46s
Also caches make_hash to prevent re-hashing the contents of static assets on every http request when offline compress is enabled.
Running offline compression is slow (
python -m jac.contrib.flask my_flask_module:create_app
). This change uses an in-memory hash to prevent re-compressing the same file more than once. If templates share common script files, this can speed up the offline compression step:Before
After
Time saved: 2m46s
Also caches
make_hash
to prevent re-hashing the contents of static assets on every http request when offline compress is enabled.This change is