Skip to content

Commit

Permalink
remove now-redundant len shortcut in _originalNames
Browse files Browse the repository at this point in the history
As Paul Scheduikat points out, the loop already does not start
if the length of name is less than minHashLength.

                       │     old     │             new              │
                       │   sec/op    │   sec/op     vs base         │
    AbiOriginalNames-8   135.6µ ± 1%   135.5µ ± 0%  ~ (p=1.000 n=7)
  • Loading branch information
mvdan committed Dec 1, 2024
1 parent 49cfcfb commit 8f71a50
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions reflect_abi_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ package main

//disabledgo:linkname _originalNames internal/abi._originalNames
func _originalNames(name string) string {
if len(name) < minHashLength {
// The name is too short to be obfuscated.
return name
}
// We can stop once there aren't enough bytes to fit another obfuscated name.
for i := 0; i <= len(name)-minHashLength; {
switch name[i] {
Expand Down

0 comments on commit 8f71a50

Please sign in to comment.