Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slower builds with transform-api and AGP 8 #7802

Closed
Gimbergsson opened this issue Apr 14, 2023 · 6 comments
Closed

Slower builds with transform-api and AGP 8 #7802

Gimbergsson opened this issue Apr 14, 2023 · 6 comments

Comments

@Gimbergsson
Copy link

How frequently does the bug occur?

Always

Description

Hi, I'm working on a project where we use Realm and now when we shifting to AGP 8 and using the transformer-api version of realm I've noticed and measured that builds is taking a lot longer to finish. For clean builds it takes about 40s-1m more and the same with incremental builds (just commenting out some code).

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

I've measured it like this.

  1. Run gradlew clean && gradlew --profile --offline --rerun-tasks :app:assembleDevDebug which took 5m 28s with 10.14.0-transformer-api and 4m 47s with 10.12.0
  2. Comment some code and run gradlew --profile --offline :app:assembleDevDebug which took 1m 57s with 10.14.0-transformer-api version and 52s with 10.12.0

Version

10.14.0-transformer-api

What Atlas App Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

Windows 10

Build environment

Android Studio version: Flamingo | 2022.2.1
Android Build Tools version: 34.0.0-rc3
Gradle version: 8 and 7.4.2

@cmelchior
Copy link
Contributor

Looking a bit into this. This is the test data from trying to compile all our samples:

./gradlew clean && ./gradlew --offline --profile --rerun-tasks assemble

Realm Java 10.12.0
Gradle 7.3.3
AGP 7.1.0
Java 11

image
image

~1 minute and 4 seconds

Realm Java 10.15.1
Gradle 8.1.1
AGP 8.0.0
Java 17

image
image

~ 40 seconds


So at least for our samples, it appears faster to use the new transformer APIs.

That said, the performance profile might change depending on the layout of the project, the number of dependencies and modules, and so on.

@Gimbergsson can you provide a bit more context about your project? How big it is it roughly? How many modules does it consist of? How many Realm model classes do you have? How is the Realm logic structured, is it confined to a single module or spread out among many modules?

@Gimbergsson
Copy link
Author

Gimbergsson commented May 2, 2023

@cmelchior Thanks for getting back of this issue. The project has 8 modules were one is the app module and 5 of them are library modules the two other are benchmarking and some in-house cli tool. It's has around 1200 Kotlin and 180 java classes with total of 140k lines of code.

Here is list of dependencies, dependency_list.txt

We have 81 tables/realm models which is confined to the app module.

But in my team I'm the only one noticing that the build speed is dramatically slower and I'm the only one using Windows. My team mates too mentioned that they also notices an improvement with the new transformer APIs. So I have a hunch that it might only be for Windows users?

@Gimbergsson
Copy link
Author

A team member that is using a mac got back and said they too get this now, (probably was like it the whole time).
I also found that that we can provide gradle scans of the builds, which are below.

  Clean build Incremental
old-transformer-api https://scans.gradle.com/s/iv6267wggi4tw https://scans.gradle.com/s/gdh64cri6fju2
new-transformer-api https://scans.gradle.com/s/lgzfw5sxrfpoi https://scans.gradle.com/s/gmdmkplwqqo2u

Notice that the new-transformer-api is faster on a clean build but more than 2x slower when doing a incremental build (as described in the issue).

@cmelchior
Copy link
Contributor

Thank you very much for those build scans, that is super valuable 👍

@clementetb
Copy link
Collaborator

The issue is that our gradle plugin based on the new transformer API does not support incremental builds.

We are currently investigating a solution.

@clementetb
Copy link
Collaborator

@Gimbergsson We have added support to incremental builds in the following PR #7816 and it will be available in the next minor release. However, if you like to try it out you can do so using the latest snapshot release.

@sync-by-unito sync-by-unito bot closed this as completed May 30, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants