Skip to content
This repository has been archived by the owner on Feb 2, 2022. It is now read-only.

Remove extraneous allocations. #3

Merged
merged 2 commits into from
Aug 7, 2017
Merged

Remove extraneous allocations. #3

merged 2 commits into from
Aug 7, 2017

Conversation

cstockton
Copy link

@cstockton cstockton commented Jul 6, 2017

What's in this PR?

I removed extraneous allocations to illustrate the techniques for use in other areas of the library if the author would like.

TODOs

I saw the CLA after I made the changes, my mistake. I'll look into it tomorrow evening maybe, depending how much information I need to disclose.

benchmark old ns/op new ns/op delta
BenchmarkDecrypt/Sample_#1-24 45900 30815 -32.86%
BenchmarkDecrypt/Sample_#2-24 45662 31572 -30.86%
BenchmarkDecrypt/Sample_#3-24 49453 39011 -21.11%
BenchmarkDecrypt/Sample_#4-24 44523 37762 -15.19%
BenchmarkDecrypt/Sample_#5-24 40971 25624 -37.46%
BenchmarkDecrypt/Sample_#6-24 45525 27824 -38.88%
BenchmarkDecrypt/Sample_#7-24 42651 30249 -29.08%
BenchmarkDecrypt/Sample_#8-24 49264 39506 -19.81%
BenchmarkDecrypt/Sample_#9-24 42568 31181 -26.75%
BenchmarkDecrypt/Sample_#10-24 42259 25162 -40.46%
BenchmarkDecrypt/Sample_#11-24 46210 32699 -29.24%
BenchmarkDecrypt/Sample_#12-24 39739 29340 -26.17%
BenchmarkDecrypt/Sample_#13-24 50127 34662 -30.85%
BenchmarkDecrypt/Sample_#14-24 52410 37990 -27.51%
BenchmarkDecrypt/Sample_#15-24 44501 30777 -30.84%

benchmark old allocs new allocs delta
BenchmarkDecrypt/Sample_#1-24 231 102 -55.84%
BenchmarkDecrypt/Sample_#2-24 237 108 -54.43%
BenchmarkDecrypt/Sample_#3-24 234 105 -55.13%
BenchmarkDecrypt/Sample_#4-24 234 105 -55.13%
BenchmarkDecrypt/Sample_#5-24 228 99 -56.58%
BenchmarkDecrypt/Sample_#6-24 237 108 -54.43%
BenchmarkDecrypt/Sample_#7-24 231 102 -55.84%
BenchmarkDecrypt/Sample_#8-24 234 105 -55.13%
BenchmarkDecrypt/Sample_#9-24 234 105 -55.13%
BenchmarkDecrypt/Sample_#10-24 228 99 -56.58%
BenchmarkDecrypt/Sample_#11-24 231 102 -55.84%
BenchmarkDecrypt/Sample_#12-24 234 105 -55.13%
BenchmarkDecrypt/Sample_#13-24 237 108 -54.43%
BenchmarkDecrypt/Sample_#14-24 237 108 -54.43%
BenchmarkDecrypt/Sample_#15-24 228 99 -56.58%

benchmark old bytes new bytes delta
BenchmarkDecrypt/Sample_#1-24 7728 2912 -62.32%
BenchmarkDecrypt/Sample_#2-24 7728 2928 -62.11%
BenchmarkDecrypt/Sample_#3-24 8176 3344 -59.10%
BenchmarkDecrypt/Sample_#4-24 8176 3344 -59.10%
BenchmarkDecrypt/Sample_#5-24 7696 2912 -62.16%
BenchmarkDecrypt/Sample_#6-24 7760 2928 -62.27%
BenchmarkDecrypt/Sample_#7-24 7728 2912 -62.32%
BenchmarkDecrypt/Sample_#8-24 8176 3344 -59.10%
BenchmarkDecrypt/Sample_#9-24 8176 3344 -59.10%
BenchmarkDecrypt/Sample_#10-24 7696 2912 -62.16%
BenchmarkDecrypt/Sample_#11-24 7728 2912 -62.32%
BenchmarkDecrypt/Sample_#12-24 7744 2928 -62.19%
BenchmarkDecrypt/Sample_#13-24 8192 3360 -58.98%
BenchmarkDecrypt/Sample_#14-24 8192 3360 -58.98%
BenchmarkDecrypt/Sample_#15-24 7696 2912 -62.16%

@anitgandhi
Copy link
Contributor

Thanks for the informative PR!

I do request that you sign the CLA if you'd like this merged. If not, would it be ok if I piggy-backed on this code and applied it to the other package as well?

@cstockton
Copy link
Author

I signed the individual CLA, though I didn't (and won't) provide a cell phone number or address. Let me know if you have any questions though I would be glad to help.

@anitgandhi anitgandhi mentioned this pull request Jul 12, 2017
@cstockton
Copy link
Author

Are you merging this or should I close?

@anitgandhi
Copy link
Contributor

@cstockton unfortunately our open source office rules require phone number and address based on what @jaredsmith told me :(

Unless something's changed on that end I will have to decline this PR

@cstockton
Copy link
Author

@jaredsmith What is your privacy policy around this personal information? It's a google doc which makes it very unclear who has access to these details. While sometimes I come across a CLA that may ask for my address, It's unusual to require a personal phone number in a CLA, under what scenario would CapitalOne even need my address- let alone call me?

@jaredsmith
Copy link

That's a great question -- we'll only contact you related to your open source contributions -- we don't use the data for any other reasons. Our legal team just likes having an address and phone number if there's a legal question about a particular contribution. The only people who have access to the data are the project leaders (so that they can see if someone has signed a CLA or not) and our Open Source Office. Nobody else has the data.

If there's any other questions I can answer regarding the CLAs or our open source office, please don't hesitate to ask.

@cstockton
Copy link
Author

@jaredsmith I'll sign it after work as long as it will not be shared with third parties, used for marketing, advertising or recruitment purposes. That is: Only used to contact me in the event a legal dispute or question on code I've contributed. Though I would appreciate being tagged here first. Maybe a little clarity on this on the document would be helpful. Thanks!

@cstockton
Copy link
Author

@anitgandhi This was signed.

@anitgandhi
Copy link
Contributor

Thanks @cstockton . Have one change to request, see the review comment

Copy link
Contributor

@anitgandhi anitgandhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything besides the ivZero thing looks good!

ff3/ff3.go Outdated
@@ -215,6 +215,8 @@ func (f Cipher) Encrypt(X string) (string, error) {
return ret, nil
}

var zeros = make([]byte, 16)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you re-use the ivZero for this? Seems like it would accomplish the same thing since you're taking a slice of it, but right now zeros feels redundant

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated this it was redundant, thanks.

@cstockton
Copy link
Author

@anitgandhi Updated pull request thanks for the patience while I figured out the CLA stuff.

@anitgandhi
Copy link
Contributor

No worries, glad the CLA stuff was sorted out @cstockton 👍

@anitgandhi anitgandhi merged commit 3d2762d into capitalone:master Aug 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants