Created
October 24, 2016 17:11
-
-
Save maximelamure/af411199bd5c93db3dd0a7133914ebc3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment