1
0
mirror of https://github.com/golang/go synced 2024-09-29 22:14:29 -06:00
The Go programming language
Go to file
ruinan da0913f814 hash/crc64: use slicing by 8 when the size is greater or equal than 2k
In the previous, we will only use the slicing by 8 look up table when
the data size is greater than 16k, but the threshold seems to be too
large. We may lose some performance for the small data size.
In this CL, we change the threshold to 2k, it shows that the performance
is improved greatly when the data size is 2k ~ 16k.

We did some tests for the Random2K ~ Random16K between various
cores(mostly on x86 and arm architecture). Here are the benchmark and
some results:

1. The benchmark for testing:

func BenchmarkRandom(b *testing.B) {
	poly := 0x58993511
	b.Run("Random256", func(b *testing.B) {
		bench(b, uint64(poly), 256)
	})
	b.Run("Random512", func(b *testing.B) {
		bench(b, uint64(poly), 512)
	})
	b.Run("Random1KB", func(b *testing.B) {
		bench(b, uint64(poly), 1<<10)
	})
	b.Run("Random2KB", func(b *testing.B) {
		bench(b, uint64(poly), 2<<10)
	})
	b.Run("Random4KB", func(b *testing.B) {
		bench(b, uint64(poly), 4<<10)
	})
	b.Run("Random8KB", func(b *testing.B) {
		bench(b, uint64(poly), 8<<10)
	})
	b.Run("Random16KB", func(b *testing.B) {
		bench(b, uint64(poly), 16<<10)
	})
}

2. Some results:

Apple silicon M1:
Benchmark                old         new         delta
Random/Random2KB-10      362MB/s     801MB/s    +121.41%
Random/Random4KB-10      360MB/s    1083MB/s    +200.93%
Random/Random8KB-10      359MB/s    1309MB/s    +264.88%
Random/Random16KB-10     358MB/s    1466MB/s    +309.79%

Neoverse N1:
Benchmark                old         new         delta
Random/Random2KB-160     397MB/s     493MB/s     +24.23%
Random/Random4KB-160     397MB/s     742MB/s     +86.86%
Random/Random8KB-160     398MB/s     995MB/s    +150.12%
Random/Random16KB-160    398MB/s    1196MB/s    +200.58%

Silver 4116:
Benchmark                old         new         delta
Random/Random2KB-48      252MB/s     418MB/s     +65.79%
Random/Random4KB-48      253MB/s     621MB/s    +145.72%
Random/Random8KB-48      254MB/s     796MB/s    +213.07%
Random/Random16KB-48     258MB/s     929MB/s    +260.46%

EPYC 7251:
Benchmark                old         new         delta
Random/Random2KB-32      255MB/s     380MB/s     +48.88%
Random/Random4KB-32      255MB/s     561MB/s    +119.73%
Random/Random8KB-32      255MB/s     738MB/s    +189.18%
Random/Random16KB-32     255MB/s     877MB/s    +243.80%

Change-Id: Ib7b4f6826c3edd6f315cac8057d52b6da252a652
Reviewed-on: https://go-review.googlesource.com/c/go/+/445475
Run-TryBot: Eric Fang <eric.fang@arm.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
2022-10-27 16:52:41 +00:00
.github .github: update issue label for pkgsite-removal 2022-09-07 16:00:20 +00:00
api os/exec: add the Cancel and WaitDelay fields 2022-10-25 03:34:36 +00:00
doc doc/go1.20: go version supports non-executable Go binaries 2022-10-24 15:56:26 +00:00
lib/time lib/time, time/tzdata: update to 2022b 2022-08-11 20:03:19 +00:00
misc misc/cgo/fortran: convert to Go test 2022-10-17 15:15:37 +00:00
src hash/crc64: use slicing by 8 when the size is greater or equal than 2k 2022-10-27 16:52:41 +00:00
test cmd/compile: in compiler errors, print more digits for floats close to an int 2022-10-20 21:52:09 +00:00
.gitattributes all: treat all files as binary, but check in .bat with CRLF 2020-06-08 15:31:43 +00:00
.gitignore internal/buildcfg: move build configuration out of cmd/internal/objabi 2021-04-16 19:20:53 +00:00
codereview.cfg codereview.cfg: add codereview.cfg for master branch 2021-02-19 18:44:53 +00:00
CONTRIBUTING.md all: restore changes from faulty merge/revert 2018-02-12 20:13:59 +00:00
LICENSE
PATENTS
README.md README.md: update wiki link 2022-04-26 16:21:18 +00:00
SECURITY.md SECURITY.md: replace golang.org with go.dev 2022-04-26 19:59:47 +00:00

The Go Programming Language

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Gopher image Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.

Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.

Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.

Download and Install

Binary Distributions

Official binary distributions are available at https://go.dev/dl/.

After downloading a binary release, visit https://go.dev/doc/install for installation instructions.

Install From Source

If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.

Contributing

Go is the work of thousands of contributors. We appreciate your help!

To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.

Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.