Skip to content

Commit 3a41094

Browse files
abner-chencwdvxdr1123
authored andcommitted
runtime: using wyrand for fastrand on linux/loong64
Benchmarks on linux/loong64: name old time/op new time/op delta Fastrand 4.06ns ± 0% 3.60ns ± 0% -11.29% (p=0.000 n=32+27) Fastrand64 7.20ns ± 0% 7.16ns ± 0% -0.52% (p=0.000 n=23+31) FastrandHashiter 49.5ns ± 1% 48.9ns ± 2% -1.24% (p=0.000 n=32+32) Fastrandn/2 4.45ns ± 0% 3.81ns ± 0% -14.37% (p=0.000 n=32+32) Fastrandn/3 4.45ns ± 0% 3.81ns ± 0% -14.32% (p=0.000 n=32+32) Fastrandn/4 4.45ns ± 0% 3.81ns ± 0% -14.33% (p=0.000 n=31+32) Fastrandn/5 4.44ns ± 0% 3.81ns ± 0% -14.26% (p=0.000 n=31+30) Change-Id: I0aba7d2331221426c44cc0d0dddecca3b585fda4 Reviewed-on: https://go-review.googlesource.com/c/go/+/446896 Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Keith Randall <khr@golang.org>
1 parent 268f462 commit 3a41094

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime/stubs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func fastrand() uint32 {
131131
// by the compiler should be in this list.
132132
if goarch.IsAmd64|goarch.IsArm64|goarch.IsPpc64|
133133
goarch.IsPpc64le|goarch.IsMips64|goarch.IsMips64le|
134-
goarch.IsS390x|goarch.IsRiscv64 == 1 {
134+
goarch.IsS390x|goarch.IsRiscv64|goarch.IsLoong64 == 1 {
135135
mp.fastrand += 0xa0761d6478bd642f
136136
hi, lo := math.Mul64(mp.fastrand, mp.fastrand^0xe7037ed1a0b428db)
137137
return uint32(hi ^ lo)

0 commit comments

Comments
 (0)