Commit 011926c
committed
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 equal1 parent 8ba2e97 commit 011926c
1 file changed
+77
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2182 | 2182 | | |
2183 | 2183 | | |
2184 | 2184 | | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
2185 | 2194 | | |
2186 | 2195 | | |
2187 | 2196 | | |
2188 | 2197 | | |
2189 | 2198 | | |
2190 | 2199 | | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
2191 | 2254 | | |
2192 | | - | |
2193 | 2255 | | |
2194 | 2256 | | |
2195 | 2257 | | |
2196 | | - | |
2197 | | - | |
2198 | | - | |
2199 | | - | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
2200 | 2263 | | |
2201 | 2264 | | |
2202 | 2265 | | |
2203 | 2266 | | |
2204 | 2267 | | |
| 2268 | + | |
2205 | 2269 | | |
2206 | 2270 | | |
2207 | 2271 | | |
| |||
2212 | 2276 | | |
2213 | 2277 | | |
2214 | 2278 | | |
2215 | | - | |
2216 | | - | |
2217 | | - | |
2218 | | - | |
2219 | | - | |
2220 | | - | |
| 2279 | + | |
| 2280 | + | |
2221 | 2281 | | |
2222 | 2282 | | |
2223 | 2283 | | |
| 2284 | + | |
2224 | 2285 | | |
2225 | | - | |
2226 | | - | |
2227 | | - | |
| 2286 | + | |
2228 | 2287 | | |
| 2288 | + | |
2229 | 2289 | | |
2230 | 2290 | | |
2231 | 2291 | | |
| |||
2239 | 2299 | | |
2240 | 2300 | | |
2241 | 2301 | | |
2242 | | - | |
2243 | | - | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
2244 | 2305 | | |
2245 | 2306 | | |
2246 | 2307 | | |
| |||
0 commit comments