benchmark old ns/op new ns/op delta BenchmarkInterpolation 2209 2116 -4.21% benchmark old allocs new allocs delta BenchmarkInterpolation 4 3 -25.00% benchmark old bytes new bytes delta BenchmarkInterpolation 496 464 -6.45%
@@ -210,8 +210,8 @@ func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (strin
buf := make([]byte, 0, estimated)
argPos := 0
- // Go 1.5 will optimize range([]byte(string)) to skip allocation.
- for _, c := range []byte(query) {
+ for i := 0; i < len(query); i++ {
+ c := query[i]
if c != '?' {
buf = append(buf, c)
continue