potiuk commented on PR #53787:
URL: https://github.com/apache/airflow/pull/53787#issuecomment-3136492481

   > @potiuk do you see any downside to this?
   
   One concern I have is that it adds 5 minutes for our static checks (you need 
to look at the timestamp of the previous pre-commit to see when the pre-commit 
started and when it endeded is in the line of the pre-commit that we want to 
check time of running:
   
   <img width="1884" height="104" alt="image" 
src="https://github.com/user-attachments/assets/d7bac950-65de-45c4-9ce3-7ac6b35ba789";
 />
   
   I double checked and it sems we have ~ 20% saving overall - so it seems to 
be worth the effort:
   
   ```
   ⏚ [jarek:~/code/airflow] pre-commit-add-oxipng+ 5s ± find . -name '*.png' 
-exec du -ch {} + | grep total$                       
   63M  total
   ⏚ [jarek:~/code/airflow] pre-commit-add-oxipng+ ± git checkout main 
   Switched to branch 'main'
   Your branch is up-to-date with 'apache/main'.
   ⏚ [jarek:~/code/airflow] main+ ± find . -name '*.png' -exec du -ch {} + | 
grep total$
   80M  total
   ```
   
   But when I run it again on those already minified files (with --all-files) 
and it took 1m46 seconds on my 18-core machine with full CPU used .... 
resulting with no changes... Which is good because it does not minify already 
minified files but also it 's not good because it's 5 minutes lost for static 
checks on every PR (we run static checks with --all-files in our CI). 
   
   It seems it's very CPU heavy with our 60 MB of .png files and it's rather a 
waste of time and build CPU to run them again and again in CI.
   
   There is also a little bit of complexity here because some of those .png 
files are generated from other pre-commits - so it has to be run as one of the 
last pre-commit - after generating the images, otherwise the gains from this 
one might be lost by reganerating the files after. Similarly there are some 
files used as static dist files that get modified - but they are used when 
compiling the FAB assets - and in this case the files should be modified BEFORE 
the fab-assets compilation - otherwise (like in the failing check) the hashes 
of the .png files change.
   
   So while idea is cool, I think adding is as automated pre-commit is a bit 
too heavy. This could be turned into a manual precommit (--hook-stage manual)  
and maybe just running it from time to time to minify them and have maybe some 
periodic reminder to do so. Could you change it this way @jbampton and add some 
instructions about it ? 
   
   That would also help with not having to deal with interaction with the other 
pre-commits above - if it's only run manually.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to