Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // goos: linux
- // goarch: amd64
- // BenchmarkFor-4 30000 40441 ns/op
- // BenchmarkRange-4 20000 80434 ns/op
- // PASS
- package main
- import "testing"
- var s = make([]byte, 73437, 73437)
- func BenchmarkFor(b *testing.B) {
- for i := 0; i != b.N; i++ {
- for j := 0; j < len(s); j++ {
- s[j] = 65
- }
- }
- }
- func BenchmarkRange(b *testing.B) {
- for i := 0; i != b.N; i++ {
- for j := range s {
- s[j] = 65
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement