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

Issue 5440111: code review 5440111: crypto: allocate less. (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:
bradfitz, golang-dev
Visibility:
Public.

Description

crypto: allocate less. The code in hash functions themselves could write directly into the output buffer for a savings of about 50ns. But it's a little ugly so I wasted a copy.

Patch Set 1 #

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

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

Total comments: 2

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

Unified diffs Side-by-side diffs Delta from patch set Stats (+87 lines, -66 lines) Patch
M src/pkg/crypto/hmac/hmac.go View 1 2 3 1 chunk +4 lines, -5 lines 0 comments Download
M src/pkg/crypto/md5/md5.go View 1 2 chunks +9 lines, -8 lines 0 comments Download
M src/pkg/crypto/openpgp/s2k/s2k.go View 1 4 chunks +6 lines, -2 lines 0 comments Download
M src/pkg/crypto/ripemd160/ripemd160.go View 1 2 chunks +9 lines, -8 lines 0 comments Download
M src/pkg/crypto/rsa/rsa.go View 1 1 chunk +2 lines, -1 line 0 comments Download
M src/pkg/crypto/sha1/sha1.go View 1 2 chunks +9 lines, -8 lines 0 comments Download
M src/pkg/crypto/sha256/sha256.go View 1 2 chunks +12 lines, -8 lines 0 comments Download
M src/pkg/crypto/sha512/sha512.go View 1 1 chunk +15 lines, -10 lines 0 comments Download
M src/pkg/crypto/tls/cipher_suites.go View 1 4 chunks +7 lines, -7 lines 0 comments Download
M src/pkg/crypto/tls/conn.go View 1 3 chunks +7 lines, -2 lines 0 comments Download
M src/pkg/crypto/tls/handshake_client.go View 1 1 chunk +4 lines, -4 lines 0 comments Download
M src/pkg/crypto/tls/handshake_server.go View 1 1 chunk +3 lines, -3 lines 0 comments Download

Messages

Total messages: 3
agl1
Hello bradfitz@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-12-05 22:27:18 UTC) #1
bradfitz
LGTM http://codereview.appspot.com/5440111/diff/2013/src/pkg/crypto/hmac/hmac.go File src/pkg/crypto/hmac/hmac.go (right): http://codereview.appspot.com/5440111/diff/2013/src/pkg/crypto/hmac/hmac.go#newcode52 src/pkg/crypto/hmac/hmac.go:52: sum := h.inner.Sum(nil) you thought it was ugly ...
12 years, 5 months ago (2011-12-06 17:21:04 UTC) #2
agl1
12 years, 5 months ago (2011-12-06 23:25:26 UTC) #3
*** Submitted as http://code.google.com/p/go/source/detail?r=58a2e71c39b9 ***

crypto: allocate less.

The code in hash functions themselves could write directly into the
output buffer for a savings of about 50ns. But it's a little ugly so I
wasted a copy.

R=bradfitz
CC=golang-dev
http://codereview.appspot.com/5440111

http://codereview.appspot.com/5440111/diff/2013/src/pkg/crypto/hmac/hmac.go
File src/pkg/crypto/hmac/hmac.go (right):

http://codereview.appspot.com/5440111/diff/2013/src/pkg/crypto/hmac/hmac.go#n...
src/pkg/crypto/hmac/hmac.go:52: sum := h.inner.Sum(nil)
On 2011/12/06 17:21:04, bradfitz wrote:
> you thought it was ugly writing to in[:0] here?

Good point, just didn't think about that!
Sign in to reply to this message.

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