Hi, has anyone tryed to compile the same project i...
# random
p
Hi, has anyone tryed to compile the same project in two computers with very different amount of cores? I'm wondering if purchasing a CPU with 16 cores and 32 threads will improve the compilation time between the same AMD cpu but with only 8 cores and 16 threads by an important amount of time.
a
In a multimodule project, the answer is definitely yes
p
and what happens if you only have the app module?
but it haves a lot of dependences, a lot of packages etc...
taking 3 minutes to compile for example in a i7 6700 4 core 8 thread cpu
I tryed in a 8600G with 6 cores and 12 threads, and compilation time just reduced to 2 minutes... very dissapointing, I wonder if using a cpu with 16 cores will decrease a lot the compilation times, of if there is a limit of cores used by android studio
a
Its going to be faster of course, but I don't think the difference will be significant. How much RAM do you have?
p
32gb
so there is not a limit of number of cores used by android studio when compiling? so the same cpu with 16 real cores will more or less reduce by half the compilation time of the same model but with only 8 cores?
s
Gradle can compile multiple modules in parallel. So you need to split your project if you want to benefit from more cores.
p
so you mean that if I only have the app module, compilation time will be the same even doubling cores from 8 to 16?
s
I was not seeing significant gain by doubling the cores, yes.
Gradle tasks depend on each other, so they can't run in parallel most of the time. But you can have modules that don't depend on each other build in parallel.
It's the same with gaming. Most of the time you benefit more from less and faster cores than having a lot of slow cores.
ChatGPT can surely help you to structure your project in a way that it can be better build in parallel, but I think that's just adding unnecessary complexity.
If the build is to slow you can also consider extracting parts out to a standalone lib.
c
Note that Gradle cannot download in parallel
👍 1
e
Yesterday I recompiled a simple program with Gradle. I hadn't changed it in two or three months, and it took minutes despite Gradle caching and all its optimizations. Compiling is CPU-intensive, but Gradle wastes time on other things. I don't think it's worth having more CPU.