Commit 6db1eec
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 M4 Pro
│ base.10.txt │ new.10.txt │
│ sec/op │ sec/op vs base │
Suite/BenchmarkExec-14 775.1n ± 1% 769.8n ± 1% -0.69% (p=0.007 n=10)
Suite/BenchmarkQuery-14 2.058µ ± 1% 2.047µ ± 1% -0.56% (p=0.002 n=10)
Suite/BenchmarkParams-14 2.269µ ± 0% 2.247µ ± 1% -0.97% (p=0.001 n=10)
Suite/BenchmarkStmt-14 1.518µ ± 1% 1.490µ ± 1% -1.91% (p=0.000 n=10)
Suite/BenchmarkRows-14 77.14µ ± 1% 76.87µ ± 1% ~ (p=0.315 n=10)
Suite/BenchmarkStmtRows-14 76.02µ ± 1% 76.02µ ± 1% ~ (p=0.971 n=10)
Suite/BenchmarkQueryParallel-14 1.059µ ± 1% 1.054µ ± 1% ~ (p=0.492 n=10)
geomean 4.442µ 4.411µ -0.70%
│ base.10.txt │ new.10.txt │
│ B/op │ B/op vs base │
Suite/BenchmarkExec-14 128.0 ± 0% 128.0 ± 0% ~ (p=1.000 n=10) ¹
Suite/BenchmarkQuery-14 688.0 ± 0% 688.0 ± 0% ~ (p=1.000 n=10) ¹
Suite/BenchmarkParams-14 1104.0 ± 0% 1000.0 ± 0% -9.42% (p=0.000 n=10)
Suite/BenchmarkStmt-14 920.0 ± 0% 816.0 ± 0% -11.30% (p=0.000 n=10)
Suite/BenchmarkRows-14 9.305Ki ± 0% 9.305Ki ± 0% ~ (p=1.000 n=10) ¹
Suite/BenchmarkStmtRows-14 9.289Ki ± 0% 9.289Ki ± 0% ~ (p=1.000 n=10) ¹
Suite/BenchmarkQueryParallel-14 592.0 ± 0% 592.0 ± 0% ~ (p=1.000 n=10) ¹
geomean 1.222Ki 1.184Ki -3.08%
¹ all samples are equal
│ base.10.txt │ new.10.txt │
│ allocs/op │ allocs/op vs base │
Suite/BenchmarkExec-14 7.000 ± 0% 7.000 ± 0% ~ (p=1.000 n=10) ¹
Suite/BenchmarkQuery-14 23.00 ± 0% 23.00 ± 0% ~ (p=1.000 n=10) ¹
Suite/BenchmarkParams-14 27.00 ± 0% 25.00 ± 0% -7.41% (p=0.000 n=10)
Suite/BenchmarkStmt-14 25.00 ± 0% 23.00 ± 0% -8.00% (p=0.000 n=10)
Suite/BenchmarkRows-14 525.0 ± 0% 525.0 ± 0% ~ (p=1.000 n=10) ¹
Suite/BenchmarkStmtRows-14 524.0 ± 0% 524.0 ± 0% ~ (p=1.000 n=10) ¹
Suite/BenchmarkQueryParallel-14 16.00 ± 0% 16.00 ± 0% ~ (p=1.000 n=10) ¹
geomean 46.62 45.56 -2.26%
¹ all samples are equal1 parent 294c2ce commit 6db1eec
3 files changed
+117
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1921 | 1921 | | |
1922 | 1922 | | |
1923 | 1923 | | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
1924 | 1933 | | |
1925 | 1934 | | |
1926 | 1935 | | |
1927 | 1936 | | |
1928 | 1937 | | |
1929 | 1938 | | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
1930 | 1993 | | |
1931 | | - | |
1932 | 1994 | | |
1933 | 1995 | | |
1934 | 1996 | | |
1935 | | - | |
1936 | | - | |
1937 | | - | |
1938 | | - | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
1939 | 2002 | | |
1940 | 2003 | | |
1941 | 2004 | | |
1942 | 2005 | | |
1943 | 2006 | | |
| 2007 | + | |
1944 | 2008 | | |
1945 | 2009 | | |
1946 | 2010 | | |
| |||
1951 | 2015 | | |
1952 | 2016 | | |
1953 | 2017 | | |
1954 | | - | |
1955 | | - | |
1956 | | - | |
1957 | | - | |
1958 | | - | |
1959 | | - | |
| 2018 | + | |
| 2019 | + | |
1960 | 2020 | | |
1961 | 2021 | | |
1962 | 2022 | | |
| 2023 | + | |
1963 | 2024 | | |
1964 | | - | |
1965 | | - | |
1966 | | - | |
| 2025 | + | |
1967 | 2026 | | |
| 2027 | + | |
1968 | 2028 | | |
1969 | 2029 | | |
1970 | 2030 | | |
| |||
1978 | 2038 | | |
1979 | 2039 | | |
1980 | 2040 | | |
1981 | | - | |
1982 | | - | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
1983 | 2044 | | |
1984 | 2045 | | |
1985 | 2046 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
0 commit comments