Thanks for the exhaustive data, Joey. I think your hardware explains it: I
have a i5-3320M and no SSD. I think that could explain your 37s build time
versus my 52s (or about 1.5 times as fast).
too, to see if it makes my setup faster or slower.
Hi Peter,
As a caveat, I'm far from an expert on the newer gradle building system,
but hopefully the details below provide some more context. Let me know if
there are any other tests I should run and provide feedback to you.
Short answer: With TextSecure, the functions of dexDebug and
proguardDebug or packageAllDebugClassesForMultiDex appear to consume the
most time in the compile process, which I haven't seen in my other apps.
Although, these issues, such as the 64k method limit per dex file, appear
to be common for larger and more complex apps.
I'm not sure how best to tweak the build system for TextSecure to reduce
compile times. I'm not even sure if shorter compile times are possible
without faster hardware. Maybe others more familiar with the gradle build
systems and the issues with method limits of the dex files can share how
best to optimize?
For the below benchmarks, I'm using the command, ./gradlew --profile
assembleDebug. When I referred to incremental builds, I was referring to
the "UP-TO-DATE" references while compiling.
Using TextSecure version 2.23.0 from 7/17, without any changes, after
running a "clean project" command, and compiling the debug version, I see
consistent build times of: *~55 seconds*
Task Duration Result
:36.669s(total)
:dexDebug14.036s
:proguardDebug14.024s
:compileDebugJava6.072s
:packageDebug1.720s
Dependencies Duration
All dependencies16.540s
:_devCompile3.083s
:_automationApk2.109s
:_releaseApk1.991s
:_automationCompile1.548s
:_debugCompile1.515s
:_releaseCompile1.508s
:_devApk1.501s
Removing proguard (debug { minifyEnabled false}), leads to compile errors
with dexDebug. Removing proguard and enabling multiDex (multiDexEnabled =
true), which as a good write up and reference links here -
http://stackoverflow.com/a/26196397/1652110, shows consistent build
times of: *~65 seconds*
Task Duration Result
:45.946s(total)
:dexDebug24.908s
:packageAllDebugClassesForMultiDex7.744s
:compileDebugJava5.680s
:shrinkDebugMultiDexComponents3.239s
:packageDebug2.192s
Dependencies Duration
All dependencies15.891s
:_devCompile2.480s
:compile2.044s
:_debugCompile1.722s
:_releaseCompile1.601s
:_releaseApk1.567s
:_automationApk1.555s
:_automationCompile1.523s
:_devApk1.508s
Building a different app, which has many fewer dependencies and I was
referencing in my email to you, I see compile times around *~10 seconds*.
Task Duration Result
:app2.699s(total)
:app:packageDebug1.190s
:app:processDebugResources0.723s
:app:mergeDebugResources0.184sUP-TO-DATE
:app:crashlyticsGenerateResourcesDebug0.125s
:app:prepareComAndroidSupportAppcompatV72220Library0.116sUP-TO-DATE
:app:compileDebugJava0.078sUP-TO-DATE
:app:zipalignDebug0.044s
:app:dexDebug0.043sUP-TO-DATE
Dependencies Duration
All dependencies1.118s
:classpath0.728s
The desktop system I'm testing on is using an SSD and an i7-4770K, not
over-clocked.
Hope all those details are helpful!
Joey
joeykrim.com
Post by Peter GoetzHi Joey,
I run my builds in the same way you do. Could you run one of your
incremental builds with the --profile option and post the breakdown here?
I'm curious how long the individual steps take in your setup. Also, how did
you enable incremental builds? I can't find any option for this and also
couldn't find anything on the Internet about it. If I see it correctly
TextSecure's default build settings don't do any magic here by default.
Also, what hardware do you have?
Thanks,
Peter
Hi Peter,
When I compile Android apps for running on my devices or the emulator
to test a change in code, I use the green arrow, highlighted in the
screenshot below. After the first build, it does incremental builds that
only take ~5-10 seconds.
The builds are different from final builds that I published in Google
Play. Two main differences between the incremental builds and the official
builds that I publish are the incremental builds not signed with my keys
and are not run through proguard. Not running through proguard seems to
significantly reduce the compile time. The builds that I publish take
around 60-90 secs to fully compile, with signed keys and proguard.
I'm running a fairly default configuration of Android Studio as I
haven't made changes to compilation process, that I recall. Hope that helps
and let me know if you have any other questions.
[image: image.png]
Post by Peter GoetzPost by Johan WeversI don't rebuild each time I've changed a single line of code when I
expect to change more.
I guess that can work. But I'm rusty with the Android API (that's
actually an understatement) and it was also extended a lot since I worked
last with it. So I *can't* really change several things at once, because
I'll have to try out a lot of small things. I want quick feedback loops.
And just finding out which line to comment out to get straight to the
MediaOverviewActivity without getting the register activity on the emulator
was a super painful process. (BTW, the emulator actually works quite well
and didn't hurt that process at all).
Post by Johan WeversPost by Peter GoetzHm. But that seems crazy. I'm definitely not an expert in Android
programming, so for me there is a lot of trial and error. And that
would
Post by Peter Goetzmean effectively that I spend ~75% of my time waiting for the the
builds. Do you really wait 2-3 minutes every time?
I don't rebuild each time I've changed a single line of code when I
expect to change more.
--
Met vriendelijke groet,
Johan Wevers