[go] encoding/hex: speed up Encode

7 views
Skip to first unread message

Gerrit Bot (Gerrit)

unread,
Sep 22, 2026, 1:21:48 PMSep 22
to goph...@pubsubhelper.golang.org, jub0bs, golang-co...@googlegroups.com

Gerrit Bot has uploaded the change for review

Commit message

encoding/hex: speed up Encode

This CL manually unrolls Encode's loop in order to reduce the number of
bounds checks that the function incurs and speed up its execution. Here
are some benchmark results (no change to allocations):

goos: darwin
goarch: arm64
pkg: encoding/hex
cpu: Apple M4
│ old │ new │
│ sec/op │ sec/op vs base │
Encode/256-10 259.4n ± 0% 156.8n ± 0% -39.55% (p=0.000 n=20)
Encode/1024-10 997.0n ± 0% 626.0n ± 0% -37.21% (p=0.000 n=20)
Encode/4096-10 3.948µ ± 0% 2.478µ ± 0% -37.23% (p=0.000 n=20)
Encode/16384-10 15.750µ ± 0% 9.886µ ± 0% -37.23% (p=0.000 n=20)
geomean 2.003µ 1.245µ -37.82%

│ old │ new │
│ B/s │ B/s vs base │
Encode/256-10 941.1Mi ± 0% 1557.5Mi ± 0% +65.50% (p=0.000 n=20)
Encode/1024-10 979.5Mi ± 0% 1560.1Mi ± 0% +59.28% (p=0.000 n=20)
Encode/4096-10 989.5Mi ± 0% 1576.2Mi ± 0% +59.29% (p=0.000 n=20)
Encode/16384-10 992.1Mi ± 0% 1580.6Mi ± 0% +59.32% (p=0.000 n=20)
geomean 975.3Mi 1.532Gi +60.82%
Change-Id: I06a6d3ad58e68913aaec614014db08fbf356dfb4
GitHub-Last-Rev: c20c977291d08052e4a9508d5aad9c962672497d
GitHub-Pull-Request: golang/go#81655

Change diff

diff --git a/src/encoding/hex/hex.go b/src/encoding/hex/hex.go
index 4499974..3a2a323 100644
--- a/src/encoding/hex/hex.go
+++ b/src/encoding/hex/hex.go
@@ -43,12 +43,38 @@
// of bytes written to dst, but this value is always [EncodedLen](len(src)).
// Encode implements hexadecimal encoding.
func Encode(dst, src []byte) int {
- j := 0
- for _, v := range src {
- dst[j] = hextable[v>>4]
- dst[j+1] = hextable[v&0x0f]
- j += 2
+ if len(src) == 0 {
+ return 0
}
+ i := 0
+ // Process the data in predictable chunks (4 src bytes, 8 dst bytes),
+ // to reduce the number of bounds checks.
+ for ; i < len(src)-3; i += 4 {
+ dst := dst[i*2 : i*2+8] // Eliminate bounds checks.
+ v0 := src[i]
+ dst[0] = hextable[v0>>4]
+ dst[1] = hextable[v0&0x0f]
+
+ v1 := src[i+1]
+ dst[2] = hextable[v1>>4]
+ dst[3] = hextable[v1&0x0f]
+
+ v2 := src[i+2]
+ dst[4] = hextable[v2>>4]
+ dst[5] = hextable[v2&0x0f]
+
+ v3 := src[i+3]
+ dst[6] = hextable[v3>>4]
+ dst[7] = hextable[v3&0x0f]
+ }
+
+ // Process the rest.
+ for ; i < len(src); i++ {
+ v := src[i]
+ dst[i*2] = hextable[v>>4]
+ dst[i*2+1] = hextable[v&0x0f]
+ }
+
return len(src) * 2
}

Change information

Files:
  • M src/encoding/hex/hex.go
Change size: S
Delta: 1 file changed, 31 insertions(+), 5 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I06a6d3ad58e68913aaec614014db08fbf356dfb4
Gerrit-Change-Number: 836885
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-CC: jub0bs <jub0bsin...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Gopher Robot (Gerrit)

unread,
Sep 22, 2026, 1:21:51 PMSep 22
to jub0bs, Gerrit Bot, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Gopher Robot added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Gopher Robot . unresolved

I spotted some possible problems with your PR:

  1. You usually need to reference a bug number for all but trivial or cosmetic fixes. For this repo, the format is usually 'Fixes #12345' or 'Updates #12345' at the end of the commit message. Should you have a bug reference?

Please address any problems by updating the GitHub PR.

When complete, mark this comment as 'Done' and click the [blue 'Reply' button](https://go.dev/wiki/GerritBot#i-left-a-reply-to-a-comment-in-gerrit-but-no-one-but-me-can-see-it) above. These findings are based on heuristics; if a finding does not apply, briefly reply here saying so.

To update the commit title or commit message body shown here in Gerrit, you must edit the GitHub PR title and PR description (the first comment) in the GitHub web interface using the 'Edit' button or 'Edit' menu entry there. Note: pushing a new commit to the PR will not automatically update the commit message used by Gerrit.

For more details, see:

(In general for Gerrit code reviews, the change author is expected to [log in to Gerrit](https://go-review.googlesource.com/login/) with a Gmail or other Google account and then close out each piece of feedback by marking it as 'Done' if implemented as suggested or otherwise reply to each review comment. See the [Review](https://go.dev/doc/contribute#review) section of the Contributing Guide for details.)

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I06a6d3ad58e68913aaec614014db08fbf356dfb4
    Gerrit-Change-Number: 836885
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: jub0bs <jub0bsin...@gmail.com>
    Gerrit-Comment-Date: Tue, 22 Sep 2026 17:21:44 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    jub0bs (Gerrit)

    unread,
    Sep 22, 2026, 1:22:56 PMSep 22
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Gopher Robot, golang-co...@googlegroups.com

    jub0bs added 1 comment

    Patchset-level comments
    Gopher Robot . resolved

    I spotted some possible problems with your PR:

      1. You usually need to reference a bug number for all but trivial or cosmetic fixes. For this repo, the format is usually 'Fixes #12345' or 'Updates #12345' at the end of the commit message. Should you have a bug reference?

    Please address any problems by updating the GitHub PR.

    When complete, mark this comment as 'Done' and click the [blue 'Reply' button](https://go.dev/wiki/GerritBot#i-left-a-reply-to-a-comment-in-gerrit-but-no-one-but-me-can-see-it) above. These findings are based on heuristics; if a finding does not apply, briefly reply here saying so.

    To update the commit title or commit message body shown here in Gerrit, you must edit the GitHub PR title and PR description (the first comment) in the GitHub web interface using the 'Edit' button or 'Edit' menu entry there. Note: pushing a new commit to the PR will not automatically update the commit message used by Gerrit.

    For more details, see:

    (In general for Gerrit code reviews, the change author is expected to [log in to Gerrit](https://go-review.googlesource.com/login/) with a Gmail or other Google account and then close out each piece of feedback by marking it as 'Done' if implemented as suggested or otherwise reply to each review comment. See the [Review](https://go.dev/doc/contribute#review) section of the Contributing Guide for details.)

    jub0bs

    Acknowledged

    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I06a6d3ad58e68913aaec614014db08fbf356dfb4
      Gerrit-Change-Number: 836885
      Gerrit-PatchSet: 1
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: jub0bs <jub0bsin...@gmail.com>
      Gerrit-Comment-Date: Tue, 22 Sep 2026 17:22:47 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Gopher Robot <go...@golang.org>
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Gerrit Bot (Gerrit)

      unread,
      Sep 22, 2026, 2:04:14 PMSep 22
      to jub0bs, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
      Attention needed from Russ Cox

      Gerrit Bot uploaded new patchset

      Gerrit Bot uploaded patch set #2 to this change.
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Russ Cox
      Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: newpatchset
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I06a6d3ad58e68913aaec614014db08fbf356dfb4
      Gerrit-Change-Number: 836885
      Gerrit-PatchSet: 2
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: jub0bs <jub0bsin...@gmail.com>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Gerrit Bot (Gerrit)

      unread,
      Sep 22, 2026, 5:08:05 PMSep 22
      to jub0bs, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
      Attention needed from Russ Cox

      Gerrit Bot uploaded new patchset

      Gerrit Bot uploaded patch set #3 to this change.
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Russ Cox
      Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: newpatchset
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I06a6d3ad58e68913aaec614014db08fbf356dfb4
      Gerrit-Change-Number: 836885
      Gerrit-PatchSet: 3
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Keith Randall (Gerrit)

      unread,
      Sep 22, 2026, 5:36:16 PMSep 22
      to jub0bs, Gerrit Bot, goph...@pubsubhelper.golang.org, Keith Randall, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Russ Cox

      Keith Randall voted

      Auto-Submit+1
      Code-Review+2
      Commit-Queue+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Russ Cox
      Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I06a6d3ad58e68913aaec614014db08fbf356dfb4
      Gerrit-Change-Number: 836885
      Gerrit-PatchSet: 3
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Keith Randall <k...@golang.org>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: jub0bs <jub0bsin...@gmail.com>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      Gerrit-Comment-Date: Tue, 22 Sep 2026 21:36:11 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Keith Randall (Gerrit)

      unread,
      Sep 22, 2026, 5:36:36 PMSep 22
      to jub0bs, Gerrit Bot, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Keith Randall, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Russ Cox

      Keith Randall voted Code-Review+1

      Code-Review+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Russ Cox
      Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I06a6d3ad58e68913aaec614014db08fbf356dfb4
      Gerrit-Change-Number: 836885
      Gerrit-PatchSet: 3
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Keith Randall <k...@golang.org>
      Gerrit-Reviewer: Keith Randall <k...@google.com>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: jub0bs <jub0bsin...@gmail.com>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      Gerrit-Comment-Date: Tue, 22 Sep 2026 21:36:30 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Gerrit Bot (Gerrit)

      unread,
      Sep 22, 2026, 5:45:22 PMSep 22
      to jub0bs, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
      Attention needed from Keith Randall, Keith Randall and Russ Cox

      Gerrit Bot uploaded new patchset

      Gerrit Bot uploaded patch set #4 to this change.
      Following approvals got outdated and were removed:
      • Code-Review: +2 by Keith Randall, +1 by Keith Randall
      • Review-Enforcement: Code-Review+2 by Keith Randall, Code-Review+1 by Keith Randall
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Keith Randall
      • Keith Randall
      • Russ Cox
      Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: newpatchset
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I06a6d3ad58e68913aaec614014db08fbf356dfb4
      Gerrit-Change-Number: 836885
      Gerrit-PatchSet: 4
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Keith Randall <k...@golang.org>
      Gerrit-Reviewer: Keith Randall <k...@google.com>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: jub0bs <jub0bsin...@gmail.com>
      Gerrit-Attention: Keith Randall <k...@golang.org>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      Gerrit-Attention: Keith Randall <k...@google.com>
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Keith Randall (Gerrit)

      unread,
      Sep 22, 2026, 6:14:06 PMSep 22
      to jub0bs, Gerrit Bot, goph...@pubsubhelper.golang.org, Keith Randall, golang...@luci-project-accounts.iam.gserviceaccount.com, Keith Randall, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Keith Randall and Russ Cox

      Keith Randall voted

      Auto-Submit+1
      Code-Review+2
      Commit-Queue+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Keith Randall
      • Russ Cox
      Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I06a6d3ad58e68913aaec614014db08fbf356dfb4
      Gerrit-Change-Number: 836885
      Gerrit-PatchSet: 4
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Keith Randall <k...@golang.org>
      Gerrit-Reviewer: Keith Randall <k...@google.com>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      Gerrit-Attention: Keith Randall <k...@google.com>
      Gerrit-Comment-Date: Tue, 22 Sep 2026 22:14:01 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Keith Randall (Gerrit)

      unread,
      Sep 22, 2026, 6:14:23 PMSep 22
      to jub0bs, Gerrit Bot, goph...@pubsubhelper.golang.org, Keith Randall, golang...@luci-project-accounts.iam.gserviceaccount.com, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Russ Cox

      Keith Randall voted Code-Review+1

      Code-Review+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Russ Cox
      Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I06a6d3ad58e68913aaec614014db08fbf356dfb4
      Gerrit-Change-Number: 836885
      Gerrit-PatchSet: 4
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Keith Randall <k...@golang.org>
      Gerrit-Reviewer: Keith Randall <k...@google.com>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: jub0bs <jub0bsin...@gmail.com>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      Gerrit-Comment-Date: Tue, 22 Sep 2026 22:14:17 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Ingo Oeser (Gerrit)

      unread,
      Sep 22, 2026, 7:53:03 PMSep 22
      to jub0bs, Gerrit Bot, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Keith Randall, Keith Randall, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Russ Cox

      Ingo Oeser added 3 comments

      Patchset-level comments
      File-level comment, Patchset 4 (Latest):
      Ingo Oeser . resolved

      Small suggestions.

      File src/encoding/hex/hex.go
      Line 68, Patchset 4 (Latest): for i := 0; i < len(src); i++ {
      Ingo Oeser . unresolved
      ```suggestion
      for i := range len(arc) {
      ```
      Line 70, Patchset 4 (Latest): dst[i*2] = hextable[v>>4]
      Ingo Oeser . unresolved

      You could also add a bound check elimination line before this line.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Russ Cox
      Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I06a6d3ad58e68913aaec614014db08fbf356dfb4
      Gerrit-Change-Number: 836885
      Gerrit-PatchSet: 4
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Keith Randall <k...@golang.org>
      Gerrit-Reviewer: Keith Randall <k...@google.com>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: Ingo Oeser <night...@googlemail.com>
      Gerrit-CC: jub0bs <jub0bsin...@gmail.com>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      Gerrit-Comment-Date: Tue, 22 Sep 2026 23:52:52 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Ingo Oeser (Gerrit)

      unread,
      Sep 22, 2026, 7:57:54 PMSep 22
      to jub0bs, Gerrit Bot, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Keith Randall, Keith Randall, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Russ Cox

      Ingo Oeser added 1 comment

      File src/encoding/hex/hex.go
      Line 68, Patchset 4 (Latest): for i := 0; i < len(src); i++ {
      Ingo Oeser . unresolved
      ```suggestion
      for i := range len(arc) {
      ```
      Ingo Oeser

      Sorry I meant len(src) here (damn autocorrect).

      Gerrit-Comment-Date: Tue, 22 Sep 2026 23:57:45 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Ingo Oeser <night...@googlemail.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      jub0bs (Gerrit)

      unread,
      Sep 23, 2026, 12:23:03 AMSep 23
      to Gerrit Bot, goph...@pubsubhelper.golang.org, Ingo Oeser, golang...@luci-project-accounts.iam.gserviceaccount.com, Keith Randall, Keith Randall, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Ingo Oeser and Russ Cox

      jub0bs added 2 comments

      File src/encoding/hex/hex.go
      Line 68, Patchset 4 (Latest): for i := 0; i < len(src); i++ {
      Ingo Oeser . resolved
      ```suggestion
      for i := range len(arc) {
      ```
      Ingo Oeser

      Sorry I meant len(src) here (damn autocorrect).

      jub0bs

      Done

      Line 70, Patchset 4 (Latest): dst[i*2] = hextable[v>>4]
      Ingo Oeser . resolved

      You could also add a bound check elimination line before this line.

      jub0bs

      This loops runs for at most three iterations; I'm not sure eliminating one of the two bounds check per iteration is worth it.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Ingo Oeser
      • Russ Cox
      Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I06a6d3ad58e68913aaec614014db08fbf356dfb4
      Gerrit-Change-Number: 836885
      Gerrit-PatchSet: 4
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Keith Randall <k...@golang.org>
      Gerrit-Reviewer: Keith Randall <k...@google.com>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: Ingo Oeser <night...@googlemail.com>
      Gerrit-CC: jub0bs <jub0bsin...@gmail.com>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      Gerrit-Attention: Ingo Oeser <night...@googlemail.com>
      Gerrit-Comment-Date: Wed, 23 Sep 2026 04:22:52 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Gerrit Bot (Gerrit)

      unread,
      Sep 23, 2026, 12:36:08 AMSep 23
      to jub0bs, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
      Attention needed from Ingo Oeser, Keith Randall, Keith Randall and Russ Cox

      Gerrit Bot uploaded new patchset

      Gerrit Bot uploaded patch set #5 to this change.
      Following approvals got outdated and were removed:
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Ingo Oeser
      • Keith Randall
      • Keith Randall
      • Russ Cox
      Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: newpatchset
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I06a6d3ad58e68913aaec614014db08fbf356dfb4
      Gerrit-Change-Number: 836885
      Gerrit-PatchSet: 5
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Keith Randall <k...@golang.org>
      Gerrit-Reviewer: Keith Randall <k...@google.com>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: Ingo Oeser <night...@googlemail.com>
      Gerrit-CC: jub0bs <jub0bsin...@gmail.com>
      Gerrit-Attention: Keith Randall <k...@golang.org>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      Gerrit-Attention: Keith Randall <k...@google.com>
      Gerrit-Attention: Ingo Oeser <night...@googlemail.com>
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      jub0bs (Gerrit)

      unread,
      3:21 AM (11 hours ago) 3:21 AM
      to Gerrit Bot, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Keith Randall, Keith Randall, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Keith Randall, Keith Randall and Russ Cox

      jub0bs voted Commit-Queue+1 on change 836885

      Commit-Queue+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Keith Randall
      • Keith Randall
      • Russ Cox
      Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I06a6d3ad58e68913aaec614014db08fbf356dfb4
      Gerrit-Change-Number: 836885
      Gerrit-PatchSet: 5
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Keith Randall <k...@golang.org>
      Gerrit-Reviewer: Keith Randall <k...@google.com>
      Gerrit-Reviewer: Russ Cox <r...@golang.org>
      Gerrit-Reviewer: jub0bs <jub0bsin...@gmail.com>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-Attention: Keith Randall <k...@golang.org>
      Gerrit-Attention: Russ Cox <r...@golang.org>
      Gerrit-Attention: Keith Randall <k...@google.com>
      Gerrit-Comment-Date: Fri, 23 Oct 2026 07:21:25 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages