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

reduce allocations when binding string/time args #1293

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Nov 5, 2024

  1. Configuration menu
    Copy the full SHA
    b3e6ac1 View commit details
    Browse the repository at this point in the history
  2. reduce allocations when binding string/time args

    This commit reduces the number of allocations required to bind args by
    eliminating string to byte slice conversions for string and time.Time
    types and by only checking for bind parameters if any of the
    driver.NamedValue args are named.
    
    goos: darwin
    goarch: arm64
    pkg: github.com/mattn/go-sqlite3
    cpu: Apple M1 Max
                               │  b.10.txt   │             x7.10.txt              │
                               │   sec/op    │   sec/op     vs base               │
    CustomFunctions-10           3.230µ ± 1%   3.253µ ± 1%  +0.73% (p=0.022 n=10)
    Suite/BenchmarkExec-10       1.240µ ± 0%   1.231µ ± 1%       ~ (p=0.210 n=10)
    Suite/BenchmarkQuery-10      3.892µ ± 1%   3.854µ ± 1%  -0.96% (p=0.009 n=10)
    Suite/BenchmarkParams-10     4.203µ ± 1%   4.163µ ± 1%  -0.94% (p=0.011 n=10)
    Suite/BenchmarkStmt-10       2.814µ ± 1%   2.763µ ± 1%  -1.81% (p=0.000 n=10)
    Suite/BenchmarkRows-10       131.2µ ± 1%   130.7µ ± 0%  -0.40% (p=0.035 n=10)
    Suite/BenchmarkStmtRows-10   131.0µ ± 1%   128.9µ ± 1%  -1.59% (p=0.043 n=10)
    geomean                      8.485µ        8.416µ       -0.82%
    
                               │   b.10.txt   │               x7.10.txt                │
                               │     B/op     │     B/op      vs base                  │
    CustomFunctions-10             568.0 ± 0%     568.0 ± 0%        ~ (p=1.000 n=10) ¹
    Suite/BenchmarkExec-10         128.0 ± 0%     128.0 ± 0%        ~ (p=1.000 n=10) ¹
    Suite/BenchmarkQuery-10        688.0 ± 0%     688.0 ± 0%        ~ (p=1.000 n=10) ¹
    Suite/BenchmarkParams-10      1104.0 ± 0%    1000.0 ± 0%   -9.42% (p=0.000 n=10)
    Suite/BenchmarkStmt-10         920.0 ± 0%     816.0 ± 0%  -11.30% (p=0.000 n=10)
    Suite/BenchmarkRows-10       9.305Ki ± 0%   9.305Ki ± 0%        ~ (p=1.000 n=10) ¹
    Suite/BenchmarkStmtRows-10   9.289Ki ± 0%   9.289Ki ± 0%        ~ (p=1.000 n=10) ¹
    geomean                      1.215Ki        1.177Ki        -3.08%
    ¹ all samples are equal
    
                               │  b.10.txt  │              x7.10.txt              │
                               │ allocs/op  │ allocs/op   vs base                 │
    CustomFunctions-10           18.00 ± 0%   18.00 ± 0%       ~ (p=1.000 n=10) ¹
    Suite/BenchmarkExec-10       7.000 ± 0%   7.000 ± 0%       ~ (p=1.000 n=10) ¹
    Suite/BenchmarkQuery-10      23.00 ± 0%   23.00 ± 0%       ~ (p=1.000 n=10) ¹
    Suite/BenchmarkParams-10     27.00 ± 0%   25.00 ± 0%  -7.41% (p=0.000 n=10)
    Suite/BenchmarkStmt-10       25.00 ± 0%   23.00 ± 0%  -8.00% (p=0.000 n=10)
    Suite/BenchmarkRows-10       525.0 ± 0%   525.0 ± 0%       ~ (p=1.000 n=10) ¹
    Suite/BenchmarkStmtRows-10   524.0 ± 0%   524.0 ± 0%       ~ (p=1.000 n=10) ¹
    geomean                      47.41        46.33       -2.26%
    ¹ all samples are equal
    charlievieth committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    0fdd7c9 View commit details
    Browse the repository at this point in the history