[perf] benchfmt: remove redundant type conversion

0 views
Skip to first unread message

Robert Findley (Gerrit)

unread,
Sep 9, 2022, 11:38:21 AM9/9/22
to shuang cui, Gerrit Bot, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Michael Knyszek, Gopher Robot, Michael Pratt, golang-co...@googlegroups.com

Robert Findley submitted this change.

View Change


Approvals: Michael Knyszek: Looks good to me, but someone else must approve Robert Findley: Looks good to me, approved; Run TryBots Gopher Robot: TryBots succeeded
benchfmt: remove redundant type conversion

Change-Id: I9e7f8d774cbdc5e7cb7f4b28503ed5ef0bffa928
GitHub-Last-Rev: f0b30d00f6bf56fe42e8e1f6e1ae366d510be329
GitHub-Pull-Request: golang/perf#4
Reviewed-on: https://go-review.googlesource.com/c/perf/+/428984
TryBot-Result: Gopher Robot <go...@golang.org>
Reviewed-by: Robert Findley <rfin...@google.com>
Reviewed-by: Michael Knyszek <mkny...@google.com>
Run-TryBot: Robert Findley <rfin...@google.com>
---
M benchfmt/internal/bytesconv/atoi.go
M benchfmt/result_test.go
2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/benchfmt/internal/bytesconv/atoi.go b/benchfmt/internal/bytesconv/atoi.go
index aded52e..4cc871a 100644
--- a/benchfmt/internal/bytesconv/atoi.go
+++ b/benchfmt/internal/bytesconv/atoi.go
@@ -234,7 +234,7 @@
}

n := 0
- for _, ch := range []byte(s) {
+ for _, ch := range s {
ch -= '0'
if ch > 9 {
return 0, &NumError{fnAtoi, string(s0), ErrSyntax}
diff --git a/benchfmt/result_test.go b/benchfmt/result_test.go
index d8fd692..6d0f376 100644
--- a/benchfmt/result_test.go
+++ b/benchfmt/result_test.go
@@ -24,7 +24,7 @@

// Check the index.
for i, cfg := range r.Config {
- gotI, ok := r.ConfigIndex(string(cfg.Key))
+ gotI, ok := r.ConfigIndex(cfg.Key)
if !ok {
t.Errorf("key %s missing from index", cfg.Key)
} else if i != gotI {
@@ -128,7 +128,7 @@
check := func(fullName string, base string, parts ...string) {
t.Helper()
got, gotParts := Name(fullName).Parts()
- fail := string(got) != string(base)
+ fail := string(got) != base
if len(gotParts) != len(parts) {
fail = true
} else {

To view, visit change 428984. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: perf
Gerrit-Branch: master
Gerrit-Change-Id: I9e7f8d774cbdc5e7cb7f4b28503ed5ef0bffa928
Gerrit-Change-Number: 428984
Gerrit-PatchSet: 2
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
Gerrit-Reviewer: Robert Findley <rfin...@google.com>
Gerrit-CC: shuang cui <imc...@gmail.com>
Gerrit-MessageType: merged
Reply all
Reply to author
Forward
0 new messages