Skip to content

Instantly share code, notes, and snippets.

@cipepser
Created January 22, 2017 05:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cipepser/68c61fa11c1371912da88d55ef316e5d to your computer and use it in GitHub Desktop.
Save cipepser/68c61fa11c1371912da88d55ef316e5d to your computer and use it in GitHub Desktop.
package MySort
import (
"testing"
"math/rand"
"time"
)
// コピーのoffset
func BenchmarkBaseCopy(b *testing.B) {
tmp := make([]int, len(a))
for i:= 0; i <b.N; i++ {
copy(tmp, a)
}
}
// 乱数生成のoffset
func BenchmarkBaseRandom(b *testing.B) {
for i:= 0; i <b.N; i++ {
rand.Seed(time.Now().UnixNano())
rand.Perm(len(a))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment