jberkel / sms-backup-plus

Backup Android SMS, MMS and call log to Gmail / Gcal / IMAP
https://play.google.com/store/apps/details?id=com.zegoggles.smssync
Apache License 2.0
1.81k stars 498 forks source link

Improve GRADLE build Performance #1072

Closed ChenZhangg closed 3 years ago

ChenZhangg commented 3 years ago

Parallel test execution maxParallelForks, running multiple test cases in parallel is useful and helpful when there are several CPU cores.

According to Process forking options, Gradle will run all tests in a single forked VM by default. This can be problematic if there are a lot of tests or some very memory-hungry ones. one option is to fork a new test VM after a certain number of tests have run. So our recommendation is to configure "forkEvery" and we give a specific value of 100

Disable report generation, Gradle will automatically create test reports by default which will slowing down the overall build. So it's better to disable the test reports while we don't need it

===================== If there are any inappropriate modifications in this PR, please give me a reply and I will change them.

kurahaupo commented 3 years ago

Thanks for that.

In general I agree with your observations and concerns. However you mention "memory hungry" tests as a justification for forking; surely it would be better to run those on their own, not in parallel with anything else?

kurahaupo commented 3 years ago

What is the benefit of

    tasks.withType(Test).configureEach {
        maxParallelForks = 4
    }

    tasks.withType(Test).configureEach {
        forkEvery = 100
    }

over

    tasks.withType(Test).configureEach {
        maxParallelForks = 4
        forkEvery = 100
    }
ChenZhangg commented 3 years ago

What is the benefit of

    tasks.withType(Test).configureEach {
        maxParallelForks = 4
    }

    tasks.withType(Test).configureEach {
        forkEvery = 100
    }

over

    tasks.withType(Test).configureEach {
        maxParallelForks = 4
        forkEvery = 100
    }

We have merged those changes into one task