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
Accelarate Realm transformer #3034
Comments
Is Groovy really slower than Kotlin? It is all byte code under the hood, which in turn is dex. I think we should switch for other reasons though, and there are probably room for improvement in any case. |
I don't think switching to Groovy would improve performance a lot, simply because most of the time is spent in Javassist. A more promising change would probably be to switch to ASM from Javassist. |
There is also some things we need to investigate from this: https://twitter.com/ebtokyo/status/808816830118653952
|
The Transform API has support for incremental builds which we're not using right now so there's space for improvements. |
@cmelchior thanks for the followup, I just wanted to update you, the slowness I reported on Twitter about Gradle was not because of Realm, it was another problem (our BuildConfig modified for each build). If we could have incremental builds support for Realm code-gen via Transform API that would be great. |
Incremental builds would be huge. When I change a line of Java code in a class unrelated to Realm, then Realm shouldn't have to transform everything again. Based on profiling my Gradle build, this would save me at least 20 seconds out of a 60 second build for the transformClassesWithRealmTransformer task, and it seems like Realm is also contributing towards the compileJavaWithJavac task. |
Any reasons why this task can take up to 38 secs?
using "io.realm:realm-gradle-plugin:3.3.2" |
@beeender @cmelchior Any update on this? It's one of the longest gradle tasks when building our app (@pinterest). Even just improving it for incremental builds would be huge. |
Several modules of our project used realm, the compile time has been steadily increasing linearly with the number of modules. But your team did not make any new progress on the issue in more than a year, any specific schedule on this? |
have been hit by realm slow compilations issues too. transformClassesWithRealm some times take more than 30 secs. |
After changing a line in layout xml or anything not even remotely connected to realm still triggers this task which takes more than half of my total build time.
|
We have added support for incremental builds in the Realm transformer and would really appreciate if you can try this out in real projects since it changes the logic about which files are being touched and also in order to get input about the improvement on real-world projects. We have released a special SNAPSHOT build that can be used to test this:
The debug log will output the amount of time used inside the transformer
Note, there are edge cases when ignored fields are being changed (marked as either |
@cmelchior - thanks for the update. I'll get that patched in on Monday and will report back. |
@cmelchior - looks like it nicely improved things. 💯 🎆 👋 👏 Before: After: [java change] [java revert] Test steps: Our realm model classes are in a separate gradle module. I think that's why in the java change and java revert steps, only show the output once because the other module didn't change. |
@cmelchior This snapshot improved my build time considerably. Previously it took more than 3 minutes to incremental builds. Now it is more or less one minute. Thanks a lot. |
@muthuraj57 Thank you for reporting back. Would it be possible to post the log numbers for your build as well? A minute still sounds like a lot for incremental builds, so would be interesting to see where the time is actually being spent |
@cmelchior - do you know when you will release the next version (5.1.1 or 5.2) that will include the new transformer improvements? |
5.2.0 should be available in the next 24 hours. |
We got some complains (http://stackoverflow.com/questions/37928953/realm-gradle-tasks) about the speed of transformers and there is always space to improve it, like:
The text was updated successfully, but these errors were encountered: