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

Issue 5448065: code review 5448065: Add a []byte argument to hash.Hash to allow an allocati... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 5 months ago by agl1
Modified:
12 years, 5 months ago
Reviewers:
CC:
rsc, cw, rog, golang-dev
Visibility:
Public.

Description

Add a []byte argument to hash.Hash to allow an allocation to be saved. This is the result of running `gofix -r hashsum` over the tree, changing the hash function implementations by hand and then fixing a couple of instances where gofix didn't catch something. The changed implementations are as simple as possible while still working: I'm not trying to optimise in this CL.

Patch Set 1 #

Patch Set 2 : diff -r 3c286b9b2206 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 3c286b9b2206 https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 3c286b9b2206 https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 5 : diff -r 5ef46981bf5e https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+202 lines, -200 lines) Patch
M src/cmd/cgo/main.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/cmd/gofix/typecheck.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/archive/tar/reader_test.go View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/crypto/ecdsa/ecdsa_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/crypto/hmac/hmac.go View 1 2 chunks +4 lines, -4 lines 0 comments Download
M src/pkg/crypto/hmac/hmac_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/crypto/md4/md4.go View 1 2 chunks +6 lines, -9 lines 0 comments Download
M src/pkg/crypto/md4/md4_test.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/crypto/md5/md5.go View 1 2 chunks +6 lines, -9 lines 0 comments Download
M src/pkg/crypto/md5/md5_test.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/crypto/ocsp/ocsp.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/crypto/openpgp/canonical_text.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/crypto/openpgp/canonical_text_test.go View 1 2 chunks +3 lines, -3 lines 0 comments Download
M src/pkg/crypto/openpgp/packet/private_key.go View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/crypto/openpgp/packet/public_key.go View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M src/pkg/crypto/openpgp/packet/signature.go View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/crypto/openpgp/packet/symmetrically_encrypted.go View 1 2 chunks +2 lines, -2 lines 0 comments Download
M src/pkg/crypto/openpgp/s2k/s2k.go View 1 2 chunks +2 lines, -2 lines 0 comments Download
M src/pkg/crypto/ripemd160/ripemd160.go View 1 2 chunks +6 lines, -6 lines 0 comments Download
M src/pkg/crypto/ripemd160/ripemd160_test.go View 1 2 chunks +3 lines, -3 lines 0 comments Download
M src/pkg/crypto/rsa/pkcs1v15_test.go View 1 2 chunks +2 lines, -2 lines 0 comments Download
M src/pkg/crypto/rsa/rsa.go View 1 3 chunks +3 lines, -3 lines 0 comments Download
M src/pkg/crypto/sha1/sha1.go View 1 2 chunks +6 lines, -9 lines 0 comments Download
M src/pkg/crypto/sha1/sha1_test.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/crypto/sha256/sha256.go View 1 2 chunks +10 lines, -12 lines 0 comments Download
M src/pkg/crypto/sha256/sha256_test.go View 1 2 chunks +4 lines, -4 lines 0 comments Download
M src/pkg/crypto/sha512/sha512.go View 1 2 chunks +14 lines, -16 lines 0 comments Download
M src/pkg/crypto/sha512/sha512_test.go View 1 2 chunks +4 lines, -4 lines 0 comments Download
M src/pkg/crypto/tls/cipher_suites.go View 1 2 chunks +3 lines, -3 lines 0 comments Download
M src/pkg/crypto/tls/handshake_client.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/crypto/tls/handshake_server.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/crypto/tls/key_agreement.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/crypto/tls/prf.go View 1 6 chunks +13 lines, -13 lines 0 comments Download
M src/pkg/crypto/x509/x509.go View 1 3 chunks +3 lines, -3 lines 0 comments Download
M src/pkg/exp/ssh/client.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/exp/ssh/client_auth_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/exp/ssh/server.go View 1 2 chunks +3 lines, -3 lines 0 comments Download
M src/pkg/exp/ssh/transport.go View 1 4 chunks +6 lines, -6 lines 0 comments Download
M src/pkg/hash/adler32/adler32.go View 1 1 chunk +6 lines, -7 lines 0 comments Download
M src/pkg/hash/crc32/crc32.go View 1 1 chunk +6 lines, -7 lines 0 comments Download
M src/pkg/hash/crc64/crc64.go View 1 1 chunk +10 lines, -11 lines 0 comments Download
M src/pkg/hash/fnv/fnv.go View 1 2 chunks +36 lines, -17 lines 0 comments Download
M src/pkg/hash/fnv/fnv_test.go View 1 3 chunks +6 lines, -6 lines 0 comments Download
M src/pkg/hash/hash.go View 1 1 chunk +3 lines, -3 lines 0 comments Download
M src/pkg/io/multi_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/patch/git.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/websocket/hixie.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/websocket/hybi.go View 1 1 chunk +1 line, -1 line 0 comments Download
M test/fixedbugs/bug257.go View 2 chunks +2 lines, -3 lines 0 comments Download

Messages

Total messages: 9
agl1
Hello rsc@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
12 years, 5 months ago (2011-11-30 21:03:10 UTC) #1
rsc
LGTM For my own curiosity, what didn't gofix fix? http://codereview.appspot.com/5448065/diff/2002/src/pkg/hash/hash.go File src/pkg/hash/hash.go (right): http://codereview.appspot.com/5448065/diff/2002/src/pkg/hash/hash.go#newcode16 src/pkg/hash/hash.go:16: ...
12 years, 5 months ago (2011-11-30 21:19:40 UTC) #2
cw
What about having the Sum() only be valid immediately after it's called and embedding the ...
12 years, 5 months ago (2011-12-01 06:14:21 UTC) #3
rog
that would mean that concurrent use of Sum would be inherently unsafe. On 1 December ...
12 years, 5 months ago (2011-12-01 09:31:35 UTC) #4
agl1
On Thu, Dec 1, 2011 at 1:14 AM, <cw@f00f.org> wrote: > What about having the ...
12 years, 5 months ago (2011-12-01 16:01:27 UTC) #5
cw
> But I'm not committed either way if people prefer the returning an > internal ...
12 years, 5 months ago (2011-12-01 16:05:50 UTC) #6
rsc
I thought some more about this on the way in. I think the appending really ...
12 years, 5 months ago (2011-12-01 16:47:54 UTC) #7
agl1
On Wed, Nov 30, 2011 at 4:19 PM, <rsc@golang.org> wrote: > For my own curiosity, ...
12 years, 5 months ago (2011-12-01 17:19:15 UTC) #8
agl1
12 years, 5 months ago (2011-12-01 17:35:45 UTC) #9
*** Submitted as http://code.google.com/p/go/source/detail?r=8f5131d7848e ***

Add a []byte argument to hash.Hash to allow an allocation to be saved.

This is the result of running `gofix -r hashsum` over the tree, changing
the hash function implementations by hand and then fixing a couple of
instances where gofix didn't catch something.

The changed implementations are as simple as possible while still
working: I'm not trying to optimise in this CL.

R=rsc, cw, rogpeppe
CC=golang-dev
http://codereview.appspot.com/5448065
Sign in to reply to this message.

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