Is it possible to speed up R8
Asked Answered
D

0

6

I'm looking at my production builds and 50% of the build time is in the task minifyProductionReleaseWithR8. Looking at Google's guides for optimizing build speed there is nothing mentioned about R8. Generally, I'm working towards breaking out more modules to enable better build parallelization but I don't know if that will affect R8 minification time.

Diplomate answered 10/10, 2022 at 23:14 Comment(4)
Probably not much because minification needs to check what the final assembly actually uses so it's one big task in the end - developer.android.com/studio/build/shrink-code#shrink-code - maybe it can preprocess submodules that depend on subsubmodules that aren't exposed to the the parent module (api vs implementation dependencies) on a per-submodule basis and in parallel.Breadthways
As mentioned above R8 shrinking is doing whole program optimization, so it is a monolithic task at the end. Breaking the project into modules will not change this final optimization. R8 is using multiple threads where possible, and we try to balance the compilation time with the shrinking gained.Guan
Yea, that's kind of what I thought, just wanted to check if anyone had any tricks. thanks!Diplomate
I got to the same conclusion, no way for optimization unfortunately. However the speed can be greatly improved with more processing power!Girardo

© 2022 - 2025 — McMap. All rights reserved.