Skip to content

Commit

Permalink
Allocate In argument metadata on stack if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
nussjustin committed Jul 18, 2020
1 parent 84af78b commit 3e215b6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,14 @@ func In(query string, args ...interface{}) (string, []interface{}, error) {
var flatArgsCount int
var anySlices bool

meta := make([]argMeta, len(args))
var stackMeta [32]argMeta

var meta []argMeta
if len(args) <= len(stackMeta) {
meta = stackMeta[:len(args)]
} else {
meta = make([]argMeta, len(args))
}

for i, arg := range args {
if a, ok := arg.(driver.Valuer); ok {
Expand Down

0 comments on commit 3e215b6

Please sign in to comment.