We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 99d4933 + e1aeba0 commit d14e375Copy full SHA for d14e375
buf.go
@@ -66,7 +66,7 @@ func (b *writeBuf) int16(n int) {
66
}
67
68
func (b *writeBuf) string(s string) {
69
- b.buf = append(b.buf, (s + "\000")...)
+ b.buf = append(append(b.buf, s...), '\000')
70
71
72
func (b *writeBuf) byte(c byte) {
buf_test.go
@@ -0,0 +1,16 @@
1
+package pq
2
+
3
+import "testing"
4
5
+func Benchmark_writeBuf_string(b *testing.B) {
6
+ var buf writeBuf
7
+ const s = "foo"
8
9
+ b.ReportAllocs()
10
+ b.ResetTimer()
11
12
+ for i := 0; i < b.N; i++ {
13
+ buf.string(s)
14
+ buf.buf = buf.buf[:0]
15
+ }
16
+}
0 commit comments