PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → wm21 slow compile and deployment
wm21 slow compile and deployment
Iniciado por guest, 12,jul. 2016 14:45 - 16 respuestas
Publicado el 12,julio 2016 - 14:45
Hi,

my notebook
Intel® Core™ i7 6500U
12 GB Ram
500GB ssd 850 evo

android Sdk 23
gradle 2.14

tablet
cyanogenMod android 4.4.2

APK size 7mb

compile take 40 seconds (rerun same time) , deploy over wi-fi take 25 seconds (rerun same)

is there anyway to speed up ?


I had tried add some setting in gradle.properties.
http://forum.pcsoft.fr/fr-FR/pcsoft.us.windev/57886-wm21-gradle-57887/read.awp

but i found out that this file is overwrite whenever compile the project. anyone know the correct way to add gradle properties in WM21 ?
Publicado el 12,julio 2016 - 14:54
Hi

Nothing much as the bottle neck is on Java stuff when generating APK and that's
why I generate ios apps for iPhone instead. Yours is with CPU benchmark of score 4324,
while the desktop of i7 might have 9000-12000, even though I guess it's only 50% fastest than yours.

Just FYI and nothing much to help out :(

Cheers

King
Publicado el 12,julio 2016 - 17:26
Hi,

Under your user document folder "My Documents" there is a ".gradle" folder where the settings are that the Java compiler uses.

It is in a file called gradle.properties

I have these settings

org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xms256m -Xmx1024m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

com.android.build.gradle.overridePathCheck=true

Maybe you can try and see if they improve your compile time.

Danny
Publicado el 12,julio 2016 - 18:42
thanks danny , but no different.

this is what i think how to set gradle properties in wm21

based on gradle documentation

The configuration is applied in following order (if an option is configured in multiple locations the last one wins):

from gradle.properties in project build dir.
from gradle.properties in gradle user home.
from system properties, e.g. when -Dsome.property is set on the command line.

system properties can be set in gradle.build . in wm21 gradle,build is set in WDJava.build file

C:\WinDev Mobile 21\Programs\Framework\Android\WDJava.build

buildscript {
repositories {
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}

System.properties [ 'com.android.build.gradle.overrideVersionCheck'] = 'true'
System.properties [ 'org.gradle.daemon'] = 'true'

System.properties [ 'org.gradle.jvmargs'] = '-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8'
System.properties [ 'org.gradle.parallel'] = 'true'
System.properties [ 'org.gradle.configureondemand'] = 'true'
System.properties [ 'com.android.build.gradle.overridePathCheck'] = 'true'


}



--------------------------------------------

android {
dexOptions {

incremental = true
preDexLibraries = false
jumboMode = false
javaMaxHeapSize = "2g"

}


when I compile no error and i can see decrease in free memory when i run compile.
too bad it's still taken 40 seconds to compile. :(
Publicado el 13,julio 2016 - 01:21
Hi . I don't think you could speed up more the process. You must add the WM code generation time to Gradle process time. I think the total time depend of project content, and if you use Maven external libraries the time will be more and more.

Gradle make a great job to optimize the process time with daemon and the other options.

The \.gradle\gradle.properties file can configure the Gradle process options and it isn't touched or modified by WM or Gradle. http://forum.pcsoft.fr/fr-FR/pcsoft.us.windev/57886-wm21-gradle-57887/read.awp

Rubén
Publicado el 13,julio 2016 - 03:45
I tried that also , same 40 seconds.

without the code , the compile took about 50 seconds but it still faster than using gradle 2.2 (more than 1 minutes) .

what I don't understand is the same code compile in wm20 took half the time to compile and deploy than wm21.

I don't know how big a project need too ,so that we can see the advantage of using gradle.

now it make me think ,may I should just continue the develop the app in wm20 and only when I need functions that support by wm21 then I go there .

:joke: I know that is stupid idea :joke:
Publicado el 13,julio 2016 - 08:11
Hi,

Probably it is also the new DEX function to support more that 65536 functions in a APK. When I enabled that in WM20 it was also a lot slower. Probably this is now enabled in WM21 by default ?

In the Advanced configuration you could try to disable "Reduce the size of generated code" and the disable "Enable the Multidex generation". If you'r app is not that big these options would not be that important.

Danny
Publicado el 13,julio 2016 - 12:16
Quote
Danny Lauwers

Hi,





Probably it is also the new DEX function to support more that 65536 functions in a APK. When I enabled that in WM20 it was also a lot slower. Probably this is now enabled in WM21 by default ?





In the Advanced configuration you could try to disable "Reduce the size of generated code" and the disable "Enable the Multidex generation". If you'r app is not that big these options would not be that important.





Danny

both are disable

I tried enable it just for testing. the compile took 135 seconds .
Publicado el 13,julio 2016 - 13:26
Hi

Try this as you have tons of RAM

org.gradle.jvmargs = -Xmx4096m or more like -Xmx6144m and

see this link

"http://www.viralandroid.com/2015/08/how-to-make-android-studio-fast.html"

if it helps.

HTH

Cheers

King
Publicado el 13,julio 2016 - 14:21
Quote
kingdr

Hi





Try this as you have tons of RAM





org.gradle.jvmargs = -Xmx4096m or more like -Xmx6144m and





see this link





"http://www.viralandroid.com/2015/08/how-to-make-android-studio-fast.html"





if it helps.





HTH





Cheers





King

i tried that before . no change in speed .
when change from 1gb to 2 gb the compile speed faster but from 2gb to 4 gb , no different . from 4gb to 6gb , slower (between 5 to 10 seconds slower)

from windows task manager I can see the memory is allocated and cpu 100% in used during compile process .

if there are no way to increase speed of compile then no choice but why is it deploy took 25 seconds . on wm20 deploy took 5 to 10 seconds . I tried manual deploy using adb is also took 7 second only. why wm21 took so much time to deploy . this part I don't understand and I always start adb connection (tcpip) prior starting WM.
Publicado el 13,julio 2016 - 14:49
Hi

Did you check off-line

Check the 'Offline work' under 'Global Gradle settings'
and it will reduce 90% gradle build time.

Perhaps see this for short

http://stackoverflow.com/questions/29391421/android-studio-gradle-takes-too-long-to-build

or consult pcSoft why wm21 is much slower than wm20.

I guess you're running w7/w10-64bit and certainly it runs faster in Lubuntu 16.04 -64bit
with the same machine as yours.

HTH

King
Publicado el 13,julio 2016 - 15:08
Hi. Tried. No change.

In my case the times generating my app are: (ever 5 sg to WM generate the java code and prepare the android folder)

First generation (Daemon isn't running): 47 sg
Second generation (Daemon is running): 32 sg
Rest generations (Daemon is running): 19 sg

More memory doesn't change noting. The Java Daemon memory usage is 2GB, no more.

Maybe if i could implement the --offline option when i doesn't use Maven the generation could be more quickly.

Rubén
Publicado el 14,julio 2016 - 03:45
Quote
kingdr

Hi





Did you check off-line





Check the 'Offline work' under 'Global Gradle settings'


and it will reduce 90% gradle build time.





Perhaps see this for short





http://stackoverflow.com/questions/29391421/android-studio-gradle-takes-too-long-to-build





or consult pcSoft why wm21 is much slower than wm20.





I guess you're running w7/w10-64bit and certainly it runs faster in Lubuntu 16.04 -64bit


with the same machine as yours.





HTH





King

thanks King. now only took 20 seconds to compile :D
Publicado el 14,julio 2016 - 14:10
Hi,

Could you share your Gradle configuration (Gradle.properties file) so other could also gain some speed ?

Thanks
Danny
Publicado el 15,julio 2016 - 02:31
Hi,

make sure install gradle 2.14 , edit C:\WinDev Mobile 21\Programs\Framework\Android\WDJava.build

add the text i highlight in red

---------------------------------------------------------------------------------------------------
buildscript {

repositories {
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}

System.properties [ 'com.android.build.gradle.overrideVersionCheck'] = 'true'
System.properties [ 'org.gradle.daemon'] = 'true'
System.properties [ 'org.gradle.jvmargs'] = '-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8'
System.properties [ 'org.gradle.parallel'] = 'true'
System.properties [ 'org.gradle.configureondemand'] = 'true'
System.properties [ 'com.android.build.gradle.overridePathCheck'] = 'true'
System.properties [ 'org.gradle.workers.max'] = '2'


}

----------------------------------------------------------------------------------------------------
gradle.startParameter.setOffline(true)
apply plugin: 'com.android.application'
Publicado el 15,julio 2016 - 11:57
Thanks !

These are my settings in the gradle.properties file under User Map, so you don't have to change stuff in the WINDEV Mobile folder.

org.gradle.daemon=true
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.configureondemand=true
com.android.build.gradle.overridePathCheck=true
com.android.build.gradle.overrideVersionCheck=true
startParameter.offline=true
org.gradle.workers.max = 4

Build time from 40sec naar 10sec !! (Gradle Time)

Make sure you are using 64bit Java because else the Xmx parameter can max be 1024.

Danny
Publicado el 15,julio 2016 - 19:11
Hi Danny,

if you count only gradle time (10 seconds) . I tried org.gradle.workers.max = 4 before .it endup slower my guess is because my cpu is only 2 cores (4 threads)


i still have 25 seconds problem in deploy through tcpip .
if i deploy using adb in command prompt. it only took 10 seconds . of course doing like that many times it is pain in as* .

since usb port on my tablet damage, i guess i will just have to live with the 25 seconds