2015-06-01 18:37 GMT+02:00 Robert DiFalco <robert.difa...@gmail.com>:
> Thanks, yeah I read that. What I'm doing now seems to work pretty well. I > just save the #getSQL and then when I use I do a > sqlContext.resultQuery(sql, [values,...]); > > Are you thinking (a) this isn't a good idea or (b) that I am not saving > any cycles? The main reason I'm doing it is that I have several unit tests > that (unfortunately) require some timing to check timeouts and such. The > first few will usually fail because the first time I construct the query > its spends a bit of time creating that query. So whichever test ran first > would fail. Extracting the string as above seemed to fix the warm-up issue. > Aha, I see. Well, the first query that uses generated meta data will suffer from the initialisation overhead for all the metadata. Unless you're doing some magic tricks with classloaders, jOOQ's metadata blocks the classloader completely in order to be fully class-loaded and intialised in one go. If that's bothering you in your tests, you might want to bootstrap 1-2 queries in your tests' @BeforeClass methods. An even cleaner solution would be to bootstrap each individual test before doing the benchmarks. I suspect that JMH provides tools for such bootstrapping, in case you're using JMH I wouldn't proceed with storing the SQL strings for all of your application, because you probably won't save too many cycles, but you might have a bit of overhead in your work. Also, as with any cache, you'll risk regressions because of stale caches - i.e. there might be a case where you pre-generate SQL that isn't really static. Of course, if you feel more at ease this way, and you've already done the work, that'll be fine, too. -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.