Slow compile time for generated jooq classes

107 views
Skip to first unread message

Ryan Short

unread,
Aug 21, 2023, 11:00:44 AM8/21/23
to jOOQ User Group
Hi

We've just started to use jooq and have got to the point of generating the classes to model our database. We're generating the source which will be stored in git so the generator is run on request and not for every build. The generator is fast, completing in about 3-4 seconds, but when clean compiling the classes that the generator creates we're seeing it take 2.5 to 3 minutes to build the 400 generated source classes. Currently we've not used the DSL anywhere in our software and are just seeing the slow time when compiling the generated source.

This means our builds are about 3x slower. Note this is only on the clean compile, recompiling without cleaning is very fast ~1-2 seconds and not an issue.

We're using the pro-java-8:jooq v3.18.5 and building with the Azul JDK 1.8.0_372-b07 on the M2 Macs. Our build is using maven 3.9.2. We're especially seeing this time when building the classes in our CI pipelines running with the Temurin Openjdk 1.8 on x86 as well as they always build from clean containers.

The other performance things I've found seem to be related to the use of the DSL and not the generated classes themselves. Is there something we're doing wrong with the generation etc that's leading to the long compile times.

Ryan

Lukas Eder

unread,
Aug 21, 2023, 11:10:47 AM8/21/23
to jooq...@googlegroups.com
Hi Ryan,

There are 2 things I recommend you do:

- Upgrade your JDK. Java 8's compiler is *much* slower than more recent versions. Our own integration test builds show a 4x speed increase going from 8 to 11 or 17.
- Turn off <recordsImplementingRecordN/>. That produces most of the generic type API usage in generated code. Few users actually need this code generation feature, so if this speeds up things, it's worth turning off

I hope this helps,
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/d0e1c04c-2740-4326-91ca-7e9b16a127e8n%40googlegroups.com.

ry...@monoicon.com

unread,
Aug 21, 2023, 11:26:59 AM8/21/23
to jOOQ User Group

Thanks for the fast response, turning off <recordsImplementingRecordN/> looks to have helped.

Lukas Eder

unread,
Aug 22, 2023, 3:11:13 AM8/22/23
to jooq...@googlegroups.com
Thanks for the feedback.

I've noticed this numerous times. Even on JDK 11 or later, turning that flag off will improve things. We'll consider changing the default value for this flag in the next release:

It's unlikely this feature is used by many users

Reply all
Reply to author
Forward
0 new messages