]> Cypherpunks repositories - gostls13.git/commitdiff
added benchmarks to rand_test.go;
authorRoger Peppe <rogpeppe@gmail.com>
Wed, 9 Dec 2009 22:23:43 +0000 (14:23 -0800)
committerRuss Cox <rsc@golang.org>
Wed, 9 Dec 2009 22:23:43 +0000 (14:23 -0800)
removed superfluous field name in lockedSource.

R=r, rsc
https://golang.org/cl/170043

src/pkg/rand/rand_test.go

index ae417a9be704b88dbde52cfd2d0642e617e7195a..e0d1da4bb70a7255c4ab0229f6fd5875c4a41e03 100644 (file)
@@ -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()
+       }
+}