Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package bench_test
- import "testing"
- func BenchmarkByteArray(b *testing.B) {
- for n := 0; n < b.N; n++ {
- GetBytes()
- }
- }
- func BenchmarkString(b *testing.B) {
- for n := 0; n < b.N; n++ {
- GetString()
- }
- }
- func GetString() string {
- filtersKey := make([]string, 0, 0)
- filtersKey = append(filtersKey, "chunks = ?")
- filtersKey = append(filtersKey, "error_message = ?")
- filtersKey = append(filtersKey, "error_status = ?")
- filtersKey = append(filtersKey, "status = ?")
- return ""
- }
- func GetBytes() string {
- filtersKey := make([][]byte, 0, 0)
- filtersKey = append(filtersKey, []byte("chunks = ?"))
- filtersKey = append(filtersKey, []byte("error_message = ?"))
- filtersKey = append(filtersKey, []byte("error_status = ?"))
- filtersKey = append(filtersKey, []byte("status = ?"))
- return ""
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement