summaryrefslogtreecommitdiff
path: root/src/pkg/rand
diff options
context:
space:
mode:
authorRoger Peppe <rogpeppe@gmail.com>2009-12-09 14:23:43 -0800
committerRoger Peppe <rogpeppe@gmail.com>2009-12-09 14:23:43 -0800
commit6aca6bc330a726dfcf129ce823695eebf5519536 (patch)
tree17e4bcbef7622bead76b22dcafa860dde61994ec /src/pkg/rand
parent642a169746796701b79e4110a460bdf56c2e9343 (diff)
downloadgolang-6aca6bc330a726dfcf129ce823695eebf5519536.tar.gz
added benchmarks to rand_test.go;
removed superfluous field name in lockedSource. R=r, rsc http://codereview.appspot.com/170043 Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/pkg/rand')
-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 ae417a9be..e0d1da4bb 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()
+ }
+}