aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Peppe <rogpeppe@gmail.com>2009-12-09 14:23:43 -0800
committerRuss Cox <rsc@golang.org>2009-12-09 14:23:43 -0800
commita8ed75d27ce464041bf91db7eaa624674f6a2145 (patch)
treee7b8d3ab10ed2ae5fbbedd1cd8ec41dc912f2b18
parent51f2932082ecfc7c92aad774be3ebea6436d662b (diff)
downloadgo-a8ed75d27ce464041bf91db7eaa624674f6a2145.tar.gz
go-a8ed75d27ce464041bf91db7eaa624674f6a2145.zip
added benchmarks to rand_test.go;
removed superfluous field name in lockedSource. R=r, rsc https://golang.org/cl/170043
-rw-r--r--src/pkg/rand/rand_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/pkg/rand/rand_test.go b/src/pkg/rand/rand_test.go
index ae417a9be7..e0d1da4bb7 100644
--- a/src/pkg/rand/rand_test.go
+++ b/src/pkg/rand/rand_test.go
@@ -312,3 +312,18 @@ func TestExpTables(t *testing.T) {
t.Errorf("fe disagrees at index %v; %v != %v\n", i, fe[i], testFe[i])
}
}
+
+// Benchmarks
+
+func BenchmarkInt63Threadsafe(b *testing.B) {
+ for n := b.N; n > 0; n-- {
+ Int63()
+ }
+}
+
+func BenchmarkInt63Unthreadsafe(b *testing.B) {
+ r := New(NewSource(1));
+ for n := b.N; n > 0; n-- {
+ r.Int63()
+ }
+}