You could probably optimise your code by using the ResultSet getters
that index by column position.
> --
> You received this message because you are subscribed to the Google
> Groups "H2 Database" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/h2-database/-/QqDpmEkg1gEJ.
> To post to this group, send email to h2-da...@googlegroups.com.
> To unsubscribe from this group, send email to
> h2-database...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.
Have a look at the code in org.h2.jdbc.JdbcResultSet at line 2856.
Replace
if (columnCount >= 3) {
with
if (columnCount * result.getRowCount() >= 10) {
and tell us what your performance profile looks like, and if it's any
better.
You might need to play with the constant a little bit.
Basically, for small numbers of rows*columns, it's cheaper to call
equalsIgnoreCase() than it is to call toUpper()
On 2012-04-23 10:01, Carl Hasselskog wrote:
Regards
Carl
It should be possible to create a subclass of JdbcResultSet called
JdbcPreparedStatementResultSet, which stores the cache in the
JdbcPreparedStatement object, so that it is only calculated once for the
PreparedStatement.
Care to give it a bash?
-----Original Message-----
From: Noel Grandin [mailto:noelg...@gmail.com]
Sent: den 24 april 2012 11:47
To: h2-da...@googlegroups.com
Cc: Carl Hasselskog
Subject: Re: Potential performance improvement
Honestly, sorry, I have no idea what your problem is, Thomas wrote all
of that build stuff.
But what about the field columnLabelMap? From what I can that is re-calcalculated in every new instance of JdbcResultSet. Can't that be cached as well?
I’ve identified the problem. It was Window’s indexing service that locked the files. Moving it to a non-indexed dir solved it. I’ll run the benchmark now and then we can see if the caching improves anything.
Regards
Carl
I’ve now created a patch for this (see attachment). Feel free to use it under whatever license suits you.
When running then benchmark the difference was negligible. However, after reading the benchmark code I couldn’t find any part of that actually would benefit from this patch (since all read are by column-index not by name). Perhaps that it something that could be added (e.g. by making queryReadResult read by column-name)? My guess would be that getting by column-name would be more common so that could potentially make the tests more similar to a real-world scenario.
Regards
Carl
I debugged your test and the column-label map is never used because the query only has two columns.
Regards
Carl
From: Noel Grandin [mailto:noelg...@gmail.com]
Sent: den 26 april 2012 13:34
To: h2-da...@googlegroups.com
Cc: Carl Hasselskog
Subject: Re: Potential performance improvement
Hmm, I ran the measurements myself, and I'm seeing an improvement, but it's on the order of 0.1%
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
Great, thanks! How big was the difference for the particular queries that were effected?