v8.run/go/exp@v0.0.26-0.20230226010534-afcdbd3f782d/fastrand/u32_test.go (about) 1 package fastrand 2 3 import ( 4 "testing" 5 ) 6 7 func BenchmarkUint32(b *testing.B) { 8 b.RunParallel(func(p *testing.PB) { 9 for p.Next() { 10 _ = Uint32() 11 } 12 }) 13 } 14 15 func BenchmarkUint32n(b *testing.B) { 16 b.RunParallel(func(p *testing.PB) { 17 for p.Next() { 18 _ = Uint32n(100000) 19 } 20 }) 21 } 22 23 func BenchmarkInt32(b *testing.B) { 24 b.RunParallel(func(p *testing.PB) { 25 for p.Next() { 26 _ = Int32() 27 } 28 }) 29 } 30 31 func BenchmarkInt31(b *testing.B) { 32 b.RunParallel(func(p *testing.PB) { 33 for p.Next() { 34 _ = Int31() 35 } 36 }) 37 }