Skip to content

Performance Optimization on getResultSetValue #773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Performance Optimization on getResultSetValue #773

wants to merge 1 commit into from

Conversation

DR9885
Copy link

@DR9885 DR9885 commented Apr 9, 2015

Performance Optimization, using ".equals" is signifigantly slower than "==".

When using "BeanPropertyRowMapper", we ran load tests and found significant lack of performance when calling "getColumnValue". I noticed that "getColumnValue" simply just calls "JdbcUtils.getResultSetValue". These tests were run on an table with roughly 70 columns.

After making change I ran three tests

  1. with existing BeanPropertyRowMapper
  2. with optimized BeanPropertyRowMapper
  3. with a Custom RowMapper, mapped exactly to the class.

Benchmark Results

  1. round: 0.38 [+- 0.11], round.block: 0.00 [+- 0.00], round.gc: 0.00 [+- 0.00], GC.calls: 1, GC.time: 0.01, time.total: 7.98, time.warmup: 0.28, time.bench: 7.70
  2. round: 0.23 [+- 0.02], round.block: 0.00 [+- 0.00], round.gc: 0.00 [+- 0.00], GC.calls: 0, GC.time: 0.00, time.total: 4.80, time.warmup: 0.22, time.bench: 4.58
  3. round: 0.22 [+- 0.02], round.block: 0.00 [+- 0.00], round.gc: 0.00 [+- 0.00], GC.calls: 0, GC.time: 0.00, time.total: 4.62, time.warmup: 0.19, time.bench: 4.43

As you can see the optimized version makes BeanPropertyRowMapper almost as fast as a custom made RowMapper.

Performance Optimization, using ".equals" is signifigantly slower than "==". 

When using "BeanPropertyRowMapper", we ran load tests and found significant lack of performance when calling "getColumnValue". I noticed that "getColumnValue" simply just calls "JdbcUtils.getResultSetValue". These tests were run on an table with roughly 70 columns.

After making change I ran three tests
1) with existing BeanPropertyRowMapper
2) with optimized BeanPropertyRowMapper
3) with a Custom RowMapper, mapped exactly to the class.

Benchmark Results
=============
1) round: 0.38 [+- 0.11], round.block: 0.00 [+- 0.00], round.gc: 0.00 [+- 0.00], GC.calls: 1, GC.time: 0.01, time.total: 7.98, time.warmup: 0.28, time.bench: 7.70
2) round: 0.23 [+- 0.02], round.block: 0.00 [+- 0.00], round.gc: 0.00 [+- 0.00], GC.calls: 0, GC.time: 0.00, time.total: 4.80, time.warmup: 0.22, time.bench: 4.58
3) round: 0.22 [+- 0.02], round.block: 0.00 [+- 0.00], round.gc: 0.00 [+- 0.00], GC.calls: 0, GC.time: 0.00, time.total: 4.62, time.warmup: 0.19, time.bench: 4.43

As you can see the optimized version makes BeanPropertyRowMapper almost as fast as a custom made RowMapper.
@jhoeller
Copy link
Contributor

Could you please create a JIRA issue for this one? We have quite a few equals comparisons between Class references in the codebase, so this might be worth revisiting on a wider scale. In any case, a JIRA issue will make sure it doesn't get lost...

Juergen

@DR9885
Copy link
Author

DR9885 commented Apr 17, 2015

@panchenko
Copy link
Contributor

This PR can be closed, as the corresponding change was performed for the whole codebase in b4095c3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants