]> Cypherpunks.ru repositories - gostls13.git/commitdiff
runtime: using wyrand for fastrand on linux/loong64
authorGuoqi Chen <chenguoqi@loongson.cn>
Fri, 4 Nov 2022 09:01:21 +0000 (17:01 +0800)
committerWayne Zuo <wdvxdr@golangcn.org>
Wed, 9 Nov 2022 06:30:59 +0000 (06:30 +0000)
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>
src/runtime/stubs.go

index 20487fdf883b5d215504658e50a25bc5c65babff..8a8aace046545c9426813ff70ce6ded2fd0d9872 100644 (file)
@@ -131,7 +131,7 @@ func fastrand() uint32 {
        // by the compiler should be in this list.
        if goarch.IsAmd64|goarch.IsArm64|goarch.IsPpc64|
                goarch.IsPpc64le|goarch.IsMips64|goarch.IsMips64le|
-               goarch.IsS390x|goarch.IsRiscv64 == 1 {
+               goarch.IsS390x|goarch.IsRiscv64|goarch.IsLoong64 == 1 {
                mp.fastrand += 0xa0761d6478bd642f
                hi, lo := math.Mul64(mp.fastrand, mp.fastrand^0xe7037ed1a0b428db)
                return uint32(hi ^ lo)