From a8ed75d27ce464041bf91db7eaa624674f6a2145 Mon Sep 17 00:00:00 2001 From: Roger Peppe Date: Wed, 9 Dec 2009 14:23:43 -0800 Subject: [PATCH] added benchmarks to rand_test.go; removed superfluous field name in lockedSource. R=r, rsc https://golang.org/cl/170043 --- src/pkg/rand/rand_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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() + } +}