Skip to content
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

[jdbc.row] Reuse (:cols builder) during fetch-all-columns! #194

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexander-yakushev
Copy link
Contributor

@alexander-yakushev alexander-yakushev commented Nov 8, 2024

Another easy way to get -15% execution time during selects. The boost comes from:

  • Looking up (:cols builder) once per row, not per each cell
  • identical? instead of = to compare against ::not-found.
  • As an extra bonus, counting the column vector directly is slightly faster than protocol-based (next.jdbc.rs/column-count builder).

Select 10k rows benchmark against current master:

Before (master):
Time per call: 4.35 ms   Alloc per call: 8,446,823b   Iterations: 2315
Time per call: 4.33 ms   Alloc per call: 8,446,793b   Iterations: 2371
Time per call: 4.32 ms   Alloc per call: 8,446,796b   Iterations: 2321

After (this PR):
Time per call: 3.67 ms   Alloc per call: 8,446,794b   Iterations: 2761
Time per call: 3.69 ms   Alloc per call: 8,446,795b   Iterations: 2745
Time per call: 3.68 ms   Alloc per call: 8,446,793b   Iterations: 2731

Copy link

codecov bot commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 83.56%. Comparing base (edee4e0) to head (9131e5a).

Files with missing lines Patch % Lines
src/toucan2/jdbc/row.clj 91.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #194      +/-   ##
==========================================
- Coverage   83.60%   83.56%   -0.04%     
==========================================
  Files          37       37              
  Lines        2501     2501              
  Branches      212      212              
==========================================
- Hits         2091     2090       -1     
- Misses        198      199       +1     
  Partials      212      212              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

1 participant