]> Cypherpunks repositories - gostls13.git/commit
encoding/base32: optimize Encode
authorkorzhao <korzhao95@gmail.com>
Wed, 5 Jul 2023 12:23:35 +0000 (20:23 +0800)
committerGopher Robot <gobot@golang.org>
Mon, 7 Aug 2023 00:26:14 +0000 (00:26 +0000)
commit20b5f3ae8b01a14195057af7e082cdcf93fa2bce
tree24bb2a00fcaa23ad04dfdaf1701f7b46f1572f29
parent2d2662f8d0b50d123da2f6674308cf5e0c21e062
encoding/base32: optimize Encode

Converts the 5 x 8-bit source byte to two 32-bit integers.
This will reduce the number of shift operations.

benchmark                      old ns/op     new ns/op     delta
BenchmarkEncode-10             9005          4426          -50.85%
BenchmarkEncodeToString-10     10739         6155          -42.69%

benchmark                      old MB/s     new MB/s     speedup
BenchmarkEncode-10             909.69       1850.81      2.03x
BenchmarkEncodeToString-10     762.84       1331.02      1.74x

Change-Id: I9418d3436b73f94a4eb4b2b525e4f83612ff4d47
Reviewed-on: https://go-review.googlesource.com/c/go/+/514095
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
src/encoding/base32/base32.go