Slow build time ~ 5 minutes

383 views
Skip to first unread message

asif.rahman...@gmail.com

unread,
Aug 22, 2018, 2:38:19 PM8/22/18
to jOOQ User Group

Hi, 

I have seen an older thread with slow JOOQ compile time as of v3.8.x (https://groups.google.com/forum/#!topic/jooq-user/vuaG9d9krDk).  It seems like that specific issue is now closed.

There were about 3500 .java files generated from codegen.  When I run gradle build on that javaCompile is taking about 5 minutes (running without --profile option takes about same time).

>gradle build --profile --parallel 

Task Duration Result
: 6m6.05s (total)
:compileJava 4m48.67s
:bootJar 36.223s
:test 35.138s
:compileTestJava 5.703s
:processResources 0.302s UP-TO-DATE
:processTestResources 0.016s NO-SOURCE
:classes 0.001s Did No Work
:assemble 0s Did No Work
:build 0s Did No Work
:check 0s Did No Work
:jar 0s SKIPPED
:testClasses 0s Did No Work


As additional optimizations I ran gradle with --parallel and increased the memory in gradle.properties to 
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

Any other suggestions?

Thanks!

asif.rahman...@gmail.com

unread,
Aug 22, 2018, 4:48:44 PM8/22/18
to jOOQ User Group
This is no longer an issue for me, guess it was really a gradle question, unrelated to jooq.  After I enabled incremental compile on the gradle config file with

apply plugin: 'java'

tasks.withType(JavaCompile) {
    //enable compilation in a separate daemon process
    options.fork = true

    //enable incremental compilation
    options.incremental = true
}

Only a gradle clean build takes 5+ minutes.  I can live with that.  Now it looks like this on incremental compile

Task Duration Result
: 1m24.65s (total)
:bootJar 36.972s
:test 36.479s
:compileJava 9.444s
:compileTestJava 1.723s UP-TO-DATE
:processResources 0.030s UP-TO-DATE
:processTestResources 0.002s NO-SOURCE
:classes 0.001s Did No Work
:testClasses 0.001s UP-TO-DATE
:assemble 0s Did No Work
:build 0s Did No Work
:check 0s Did No Work
:jar 0s SKIPPED


Thanks.

Lukas Eder

unread,
Aug 23, 2018, 6:41:55 AM8/23/18
to jooq...@googlegroups.com
Hi Asif,

Thanks for your message and for your update. Indeed, incremental building is definitely recommended with jOOQ generated classes. The code generator will only touch generated code if it has been modified, leaving the file timestamps alone otherwise. Incremental compilers can pick up on this and optimise their second compilation run.

Note also that jOOQ 3.10 introduced a new code generation configuration flag called <recordsImplementingRecordN/>:

Setting this to false will remove the Record1, Record2, ... Record22 super type declarations from generated records. In larger schemas, removing these can definitely improve compilation speeds due to the amount of generic type information that can be avoided. Would be curious to see your updated clean build and incremental build times if you set that flag to false

Thanks,
Lukas

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

Asif Rahman

unread,
Aug 23, 2018, 2:45:11 PM8/23/18
to jooq...@googlegroups.com
Thanks Lukas, 

I re-ran codegen with the recordsImplementingRecordN flag set to false, saved about 20-30 seconds.  Overall still about ~4:30 min.  

Thanks


Task Duration Result
: 6m9.56s (total)
:compileJava 4m20.20s
:test 40.153s
:bootJar 35.250s
:clean 29.485s
:compileTestJava 4.368s
:processResources 0.098s
:processTestResources 0.004s NO-SOURCE
:assemble 0.001s Did No Work
:testClasses 0.001s Did No Work
:build 0s Did No Work
:check 0s Did No Work
:classes 0s Did No Work
:jar 0s SKIPPED


You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/2Danfh893bM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jooq-user+...@googlegroups.com.

Lukas Eder

unread,
Aug 24, 2018, 8:59:09 AM8/24/18
to jooq...@googlegroups.com
Thanks a lot for the feedback. That's already something - the feature is rather optional. Given that there's a significant improvement, it can definitely be skipped...

Thanks,
Lukas

Asif Rahman

unread,
Aug 28, 2018, 5:38:03 PM8/28/18
to jooq...@googlegroups.com
Setting up build caching in gradle.properties has helped a lot too, just fyi.  Thanks.

org.gradle.caching=true
org.gradle.caching.debug=true
Reply all
Reply to author
Forward
0 new messages