Commit 0fdd7c9
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 b3e6ac1 commit 0fdd7c9
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