I hereby claim:
- I am rodrwan on github.
- I am rodrwan (https://keybase.io/rodrwan) on keybase.
- I have a public key ASCy32TZXV-XDV9Ip2LmDIZEhLA7RuOZjzmIp2IPZhVAJgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| package main | |
| import ( | |
| "fmt" | |
| "strings" | |
| ) | |
| func main() { | |
| ids := []string{"id 1", "id 2", "id 3", "id 4", "id 5"} | |
| // output: [{ id: id 1 },{ id: id 2 },{ id: id 3 },{ id: id 4 },{ id: id 5 }] |
| package main | |
| import ( | |
| "bytes" | |
| "fmt" | |
| ) | |
| func main() { | |
| ids := []string{"id 1", "id 2", "id 3", "id 4", "id 5"} | |
| fmt.Println(concatWithBuffer(ids)) |
goos: darwin
goarch: amd64
| Function-CPU threads | # b.N used | ns per loop | memory allocated per loop | # memory allocations per loop |
|---|---|---|---|---|
| BenchmarkConcatWithStrings-8 | 657294 | 1808 ns/op | 400 B/op | 15 allocs/op |
| BenchmarkConcatWithBuffer-8 | 824786 | 1432 ns/op | 320 B/op | 12 allocs/op |