www-new/scripts
Amy Wang 443925190e
continuous-integration/drone/push Build is passing Details
Improve image optimization run-time and memory usage (#457)
This PR aims to resolve the issues surrounding the optimize-images script, at least in the short term, in order to unblock other work.

**Problems:** Our optimize-images script was taking a very long time to run (~7 minutes in CI, when successful). This led to two problems:
1. It was near impossible to run the script locally.
2. CI jobs would often get killed on the optimize-images step.

**Solutions:**
1. Resize the images in `images/events` prior to optimizing them, similar to what is done for the images in `images/team`. This solution on its own reduced the run-time of the script to ~30 seconds locally on Amy's laptop, which is comparable to the run-time of the script back when it was originally written.
2. EDIT: Copy/resize/optimize the images in batches of 32 at a time. The reason why the CI job was being killed is because the script would run out of memory, however this change should resolve that while also keeping build times reasonable (~30 sec locally/when deploying on caffeine, ~3 min in CI). ~~As a temporary fix, this PR also replaces the images in `images/events` with their resized + optimized versions. (For some unknown reason, Solution 1 is not sufficient to solve Problem 2.)~~

This PR also adds some logging to the script so we can get a (slightly) better sense of where the script is getting stuck.

Related issue: #456

Co-authored-by: Amy <a258wang@uwaterloo.ca>
Reviewed-on: #457
Reviewed-by: Shahan Neda <snedadah@csclub.uwaterloo.ca>
2022-06-04 19:31:00 -04:00
..
change-dates.ts Add endDate to events (#446) 2022-05-25 20:58:12 -04:00
check-lockfile.ts Dynamically generate event calendar (#332) 2021-09-27 16:20:18 -04:00
generate-calendar.ts Add endDate to events (#446) 2022-05-25 20:58:12 -04:00
optimize-images.ts Improve image optimization run-time and memory usage (#457) 2022-06-04 19:31:00 -04:00