go-sql-driver/mysql — pull request #76 by arnehormann (2013-05-14 15:42:59+00:00)
Title: add more benchmarks

move benchmarks back into own file
add benchmark by bradfitz
add benchmark suite from go-sql-driver

This should ease testing of speed and allocations, we can stay inside the repository and don't have to worry about library versioning.

I used this to check the mem-pool PR.
Results for `go test -bench=. -benchmem -benchtime 10s` (OS X 64, Go 1.1):

**this version as is**
```
PASS
BenchmarkQuery	1000000	25922 ns/op	585 B/op	24 allocs/op
BenchmarkRoundtripTxt	100000	1038977 ns/op	207769 B/op	14 allocs/op
BenchmarkRoundtripBin	200000	855491 ns/op	510250 B/op	26 allocs/op
BenchmarkSimpleQuery	100000	209500 ns/op	8801 B/op	412 allocs/op
BenchmarkPreparedQuery	100000	227128 ns/op	5639 B/op	318 allocs/op
BenchmarkAutoQueryRow	100000	169876 ns/op	733 B/op	26 allocs/op
BenchmarkSimpleQueryRow	200000	109934 ns/op	553 B/op	17 allocs/op
BenchmarkPreparedQueryRow	200000	102223 ns/op	634 B/op	25 allocs/op
BenchmarkSimpleExec	500000	46630 ns/op	80 B/op	3 allocs/op
BenchmarkPreparedExec	500000	43215 ns/op	150 B/op	7 allocs/op
```

**this version merged with mem-pool**
```
PASS
BenchmarkQuery	1000000	27478 ns/op	425 B/op	19 allocs/op
BenchmarkRoundtripTxt	100000	1033229 ns/op	189967 B/op	12 allocs/op
BenchmarkRoundtripBin	200000	847945 ns/op	408143 B/op	22 allocs/op
BenchmarkSimpleQuery	100000	210917 ns/op	8660 B/op	410 allocs/op
BenchmarkPreparedQuery	100000	220103 ns/op	5530 B/op	316 allocs/op
BenchmarkAutoQueryRow	100000	169921 ns/op	524 B/op	20 allocs/op
BenchmarkSimpleQueryRow	200000	111585 ns/op	411 B/op	15 allocs/op
BenchmarkPreparedQueryRow	200000	101977 ns/op	458 B/op	20 allocs/op
BenchmarkSimpleExec	500000	48310 ns/op	48 B/op	2 allocs/op
BenchmarkPreparedExec	500000	42203 ns/op	134 B/op	6 allocs/op
```