That's a cool idea! I also had another (which is not mutually exclusive to 
yours). Perhaps one can cache the column-mapping in JdbcPreparedStatement and 
re-use it for every execution of the same query. I don't know if there's any 
corner case where JdbcPreparedStatement might have different column-mappings in 
different executions but perhaps one can make it an optional feature?

Regards
Carl

-----Original Message-----
From: Noel Grandin [mailto:[email protected]] 
Sent: den 23 april 2012 14:07
To: [email protected]
Cc: Carl Hasselskog
Subject: Re: Potential performance improvement

I had an idea.

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:
> Hi,
> I've noticed that when I make queries that return just a single row 
> (or very few rows) then H2 spends a fair amount of time in 
> JdbcResultSet.getColumnIndex(String columnLabel). I've profiled it and 
> noticed that a big part of that is spent in 
> StringUtils.toUpperEnglish(String s). It does this despite the fact 
> that I've specified DATABASE_TO_UPPER=FALSE in the URL. A potential 
> performance improvement could be to not call 
> StringUtils.toUpperEnglish(String s) if 
> DbSettings.databaseToUpper==false. I guess that would be more correct 
> in a semantic sense as well.
>
> Regards
> Carl Hasselskog
> --
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/h2-database?hl=en.


-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to