aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorJulien Cretel <jub0bsinthecloud@gmail.com>2026-03-25 22:32:18 +0000
committerGopher Robot <gobot@golang.org>2026-03-26 08:54:47 -0700
commite4fcdc6c55bfdc90f4f42eefc4e97998de3ef4e7 (patch)
tree7409b30d17c21086768a4f0c54ee65a4b0556f17 /src/runtime
parent286a79658efbe6dcbea53aaf8112abeb8e9f2cc3 (diff)
downloadgo-e4fcdc6c55bfdc90f4f42eefc4e97998de3ef4e7.tar.xz
encoding/{base32,base64}: speed up Encode
This CL clarifies (*Encoding).Encode and speeds it up by reducing the number of bounds checks in its loop. Here are some benchmark results (no change to allocations): goos: darwin goarch: arm64 pkg: encoding/base32 cpu: Apple M4 │ old │ new │ │ sec/op │ sec/op vs base │ EncodeToString-10 7.310µ ± 0% 5.308µ ± 0% -27.39% (n=180) Encode-10 5.651µ ± 0% 3.603µ ± 0% -36.25% (n=180) geomean 6.427µ 4.373µ -31.96% │ old │ new │ │ B/s │ B/s vs base │ EncodeToString-10 1.044Gi ± 0% 1.437Gi ± 0% +37.71% (p=0.000 n=180) Encode-10 1.350Gi ± 0% 2.118Gi ± 0% +56.88% (p=0.000 n=180) geomean 1.187Gi 1.745Gi +46.98% pkg: encoding/base64 │ old │ new │ │ sec/op │ sec/op vs base │ EncodeToString-10 7.058µ ± 0% 6.034µ ± 0% -14.51% (n=180) │ old │ new │ │ B/s │ B/s vs base │ EncodeToString-10 1.081Gi ± 0% 1.264Gi ± 0% +16.97% (p=0.000 n=180) Updates #20206 Change-Id: I7d46891ddb4371df004bfd612a8efc6638715b94 GitHub-Last-Rev: 1caac3d65532fefacbbed57f11a4a49273f173e2 GitHub-Pull-Request: golang/go#78344 Reviewed-on: https://go-review.googlesource.com/c/go/+/759100 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime')
0 files changed, 0 insertions, 0 deletions