mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: implement fastrand in go
So it could be inlined. Using bit-tricks it could be implemented without condition (improved trick version by Minux Ma). Simple benchmark shows it is faster on i386 and x86_64, though I don't know will it be faster on other architectures? benchmark old ns/op new ns/op delta BenchmarkFastrand-3 2.79 1.48 -46.95% BenchmarkFastrandHashiter-3 25.9 24.9 -3.86% Change-Id: Ie2eb6d0f598c0bb5fac7f6ad0f8b5e3eddaa361b Reviewed-on: https://go-review.googlesource.com/34782 Reviewed-by: Minux Ma <minux@golang.org> Run-TryBot: Minux Ma <minux@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
9f75ecd5e1
commit
d03c124860
12 changed files with 43 additions and 105 deletions
|
|
@ -245,3 +245,5 @@ func CountPagesInUse() (pagesInUse, counted uintptr) {
|
|||
|
||||
return
|
||||
}
|
||||
|
||||
func Fastrand() uint32 { return fastrand() }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue