diff options
| author | korzhao <korzhao95@gmail.com> | 2023-07-05 20:23:35 +0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-08-07 00:26:14 +0000 |
| commit | 20b5f3ae8b01a14195057af7e082cdcf93fa2bce (patch) | |
| tree | 24bb2a00fcaa23ad04dfdaf1701f7b46f1572f29 /src/encoding/json/encode.go | |
| parent | 2d2662f8d0b50d123da2f6674308cf5e0c21e062 (diff) | |
| download | go-20b5f3ae8b01a14195057af7e082cdcf93fa2bce.tar.xz | |
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>
Diffstat (limited to 'src/encoding/json/encode.go')
0 files changed, 0 insertions, 0 deletions
