Slow build time with Android Studio v0.8.0

472 views
Skip to first unread message

thierryd

unread,
Jul 2, 2014, 10:38:56 AM7/2/14
to adt...@googlegroups.com
Hi all,
I have switched from Eclipse to Android Studio and my build is a lot slower. The same code modifications result in a 18 seconds build time in Eclipse, but 34 seconds in Android Studio. I'm just curious if this behavior is considered "normal". Xavier said last week at I/O that the tool team is now focusing on improving performance. So I guess that the tools integration is currently not as tight as in Eclipse. Am I right?

 

Xavier Ducrohet

unread,
Jul 2, 2014, 1:40:16 PM7/2/14
to adt...@googlegroups.com
You can run from the command line with --profile to see what takes time.

As I mentioned during IO there are some known bottlenecks that we are working through. I'm interested in seeing the result of your profiling (if you can't publish it as is, just let me know what kind of tasks takes a lot of time and what the evaluation time is as well).


On Wed, Jul 2, 2014 at 7:38 AM, thierryd <thie...@gmail.com> wrote:
Hi all,
I have switched from Eclipse to Android Studio and my build is a lot slower. The same code modifications result in a 18 seconds build time in Eclipse, but 34 seconds in Android Studio. I'm just curious if this behavior is considered "normal". Xavier said last week at I/O that the tool team is now focusing on improving performance. So I guess that the tools integration is currently not as tight as in Eclipse. Am I right?

 

--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com

Please do not send me questions directly. Thanks!

thierryd

unread,
Jul 3, 2014, 10:48:41 AM7/3/14
to adt...@googlegroups.com
Xavier, I would be happy to get you some profiling data. I've looked into Android studio and I cannot find where I can put the "--profile" flag. Any suggestions? Merci! :)

Gonçalo Silva

unread,
Jul 3, 2014, 11:03:19 AM7/3/14
to adt...@googlegroups.com
I see the exact same behaviour. For small changes, Eclipse is always 2 or 3 times faster.

I cannot share my profile, but here's everything that takes more than 0.5s (I'm using the --daemon and --parallel options):
- Configuration (2.8s, 0.7s of which are from the main project)
- Dependency resolution (all dependencies, since none individually takes more than 0.5s)
- dexDebug (10.97s)
- compileDebugJava (4.7s)
- packageDebug (1.8s)

In total it takes 26.5 seconds. I should note that an equivalent build using Eclipse takes roughly 10 seconds.

One thing that puzzles me is dex. Both of them run dex, but under Gradle it takes more time than the whole compilation and packaging in Eclipse. How is this possible? Another thing about dex is that it seems to use 4 cores on my system, while I have 8. Unsure if any benefit would come from using all 8.

Best regards,
Gonçalo Silva.

Xavier Ducrohet

unread,
Jul 7, 2014, 12:29:03 PM7/7/14
to adt...@googlegroups.com
By default ADT doesn't do dex in the on-save-build action. This is delayed until you actually try to launch the app (or export it).

We do this because from the IDE, you mostly care about your Java code compiling.

Studio has a similar option, I think, but obviously if you run from the command line with "assemble<name> --profile" you will actually build the whole app.

In term of performance I would expect the following difference:
- ADT will start building faster while Studio will spend some time doing the configuration phase. This will go away(*)
- ADT will compile the Java code faster (incremental builds).
- Compile-only builds will be slight slower in the aapt phase in Studio because the single-aapt step in Gradle also compiles the resources in their binary format.
- However, full builds will be slower in ADT/Ant in the aapt-phase because they run aapt twice, once for R.java and once for the packaged resources. If you have a lot of resources this will be even worse as aapt has to read/parse them twice. Studio using a single aapt step to do both.
- Studio also pre-merges the resources before sending them to aapt. It does it incrementally too. This reduces the amount of work aapt has to do for overlays (which it doesn't do incrementally).
- dexing should be the same, as both ADT/Ant and Gradle use pre-dexing, but Gradle runs pre-dexing in parallel.
- Packaging should be mostly identical.



Valerio Santinelli

unread,
Jul 9, 2014, 5:07:05 AM7/9/14
to adt...@googlegroups.com
Hi Xavier,

here's the profiling report of a project made up of two apps with common libraries and different resources. 

Valerio
profile.zip
Reply all
Reply to author
Forward
0 new messages