Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(895)

Issue 7038051: code review 7038051: src: Use bytes.Equal instead of bytes.Compare where pos... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
5 years, 4 months ago by mdempsky
Modified:
5 years, 4 months ago
Reviewers:
CC:
golang-dev, dfc, adg, rsc
Visibility:
Public.

Description

src: Use bytes.Equal instead of bytes.Compare where possible. bytes.Equal is simpler to read and should also be faster because of short-circuiting and assembly implementations. Change generated automatically using: gofmt -r 'bytes.Compare(a, b) == 0 -> bytes.Equal(a, b)' gofmt -r 'bytes.Compare(a, b) != 0 -> !bytes.Equal(a, b)'

Patch Set 1 #

Patch Set 2 : diff -r d0d76b7fb219 https://code.google.com/p/go #

Patch Set 3 : diff -r d0d76b7fb219 https://code.google.com/p/go #

Patch Set 4 : diff -r d0d76b7fb219 https://code.google.com/p/go #

Patch Set 5 : diff -r d0d76b7fb219 https://code.google.com/p/go #

Patch Set 6 : diff -r be6ca9f6bfe8 https://code.google.com/p/go #

Patch Set 7 : diff -r be6ca9f6bfe8 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+25 lines, -25 lines) Patch
M src/cmd/gofmt/gofmt_test.go View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M src/cmd/gofmt/long_test.go View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/bufio/bufio_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/crypto/rsa/pkcs1v15_test.go View 1 4 chunks +4 lines, -4 lines 0 comments Download
M src/pkg/crypto/rsa/rsa_test.go View 1 3 chunks +3 lines, -3 lines 0 comments Download
M src/pkg/encoding/asn1/asn1_test.go View 1 3 chunks +3 lines, -3 lines 0 comments Download
M src/pkg/encoding/asn1/marshal_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/encoding/hex/hex_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/encoding/json/decode_test.go View 1 2 chunks +2 lines, -2 lines 0 comments Download
M src/pkg/encoding/json/scanner_test.go View 1 3 chunks +3 lines, -3 lines 0 comments Download
M src/pkg/exp/locale/collate/collate_test.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/exp/locale/collate/maketables.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/go/doc/doc_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/math/big/int_test.go View 1 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 8
mdempsky
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
5 years, 4 months ago (2013-01-03 22:59:47 UTC) #1
dfc
Can you please update the description with benchmarks for the packages affected. On Fri, Jan ...
5 years, 4 months ago (2013-01-03 23:00:43 UTC) #2
dfc
On Fri, Jan 4, 2013 at 10:00 AM, Dave Cheney <dave@cheney.net> wrote: > Can you ...
5 years, 4 months ago (2013-01-03 23:03:42 UTC) #3
adg
Please make the CL description begin with this line: src: use bytes.Equal instead of bytes.Compare ...
5 years, 4 months ago (2013-01-06 21:37:07 UTC) #4
rsc
You can add him to the CONTRIBUTORS file using 'hg sync'.
5 years, 4 months ago (2013-01-06 22:25:08 UTC) #5
mdempsky
Hello golang-dev@googlegroups.com, dave@cheney.net, adg@golang.org, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
5 years, 4 months ago (2013-01-06 22:48:36 UTC) #6
adg
LGTM
5 years, 4 months ago (2013-01-06 23:02:56 UTC) #7
adg
5 years, 4 months ago (2013-01-06 23:04:00 UTC) #8
*** Submitted as https://code.google.com/p/go/source/detail?r=ae4e014e0b77 ***

src: Use bytes.Equal instead of bytes.Compare where possible.

bytes.Equal is simpler to read and should also be faster because
of short-circuiting and assembly implementations.

Change generated automatically using:
  gofmt -r 'bytes.Compare(a, b) == 0 -> bytes.Equal(a, b)'
  gofmt -r 'bytes.Compare(a, b) != 0 -> !bytes.Equal(a, b)'

R=golang-dev, dave, adg, rsc
CC=golang-dev
https://codereview.appspot.com/7038051

Committer: Andrew Gerrand <adg@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld e4aa27b