Name Time1 Percent2 RowReader3 ScanRow4 Native5 SQLX6 Combined7 Multi8 Individual9 Note
Reads into testStruct1 (37 fields total)
Faster1.129-
Multi Faster1.215108%
Individual Faster1.593141%
Native2.397212%
Native Prepared2.852253% Uses prepared statement instead of a query
SQLX4.973440%
ScanRow (no RowReader) into testStruct110
SRMul Faster1.882-
SRMul Multi Faster3.578190%
SRMul Individual Faster7.694409%
SRMul Native2.205117% Unlike the first “Native” test, pointers to variables are precalculated in an array.
Reading into a struct with 1 member
SROne Faster.05324-
SROne ScanRow.21000394%
SROne Native.05979112%
1) Time in seconds to run 1 million iterations of just the scanning. SQL Query/Next functions occur before benchmark timing starts.
2) Percent time slower than the base test.
3) Uses RowReader.ScanRows() for reading
4) Uses gofastersql.ScanRow() functions (no RowReader)
5) Uses native sql.Rows.Scan
6) Uses sqlx library
7) Passes in just the testStruct1 variable
8) Passes in the top level members of the testStruct1 variable (5 variables)
9) Passes in all members of testStruct1 individually (37 fields total)
10) Reading without a RowReader is expected to take much longer, but using it with a single struct is still usually faster than the alternatives.