Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Realm gradle tasks

Tags:

android

realm

During my profile report of assembleDebug gradle task I discovered two realm related gradle sub-tasks which takes quite big amount of time:

assembleDebug - 1m21.44s
- transformClassesWithRealmOptionalAPITransformerForDebug - 22.386s
- transformClassesWithRealmTransformerForIdeDebug - 10.062s

Questions:

  • what exactly those realm related gradle sub tasks do? Can I skip them at some point?
  • why they took so long? (22 + 10 = 32 sec)

Update

As a workaround I am skipping task via -x script parameter

assembleDebug -x transformClassesWithRealmOptionalAPITransformerForDebug
like image 410
Dmytro Danylyk Avatar asked Jun 20 '16 18:06

Dmytro Danylyk


1 Answers

transformClassesWithRealmOptionalAPITransformerForDebug is created for removing RxJava related APIs since it might create troubles for some cases (cases which need reflection like https://realm.io/docs/java/latest/#jackson-databind) which doesn't have the RxJava dependency. But we found it doesn't play well in some occasions like https://github.com/realm/realm-java/issues/3033 and https://github.com/realm/realm-java/issues/3022 . So it will be disabled in the next release after v1.0.1.

transformClassesWithRealmTransformerForIdeDebug is the core part Realm relies on. Basically it replace the field access to the RealmObject with Realm accessors by bytecode manipulating. You can see this post for a bit more details. Thus, this task cannot be skipped.

PS. an issue is created to track the transformer speed improvement.

like image 61
beeender Avatar answered Oct 17 '22 01:10

beeender