From: Roger Peppe Date: Wed, 9 Dec 2009 22:23:43 +0000 (-0800) Subject: added benchmarks to rand_test.go; X-Git-Tag: weekly.2009-12-09~1 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a8ed75d27ce464041bf91db7eaa624674f6a2145;p=gostls13.git added benchmarks to rand_test.go; removed superfluous field name in lockedSource. R=r, rsc https://golang.org/cl/170043 --- 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() + } +}