Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize v1 and v2 storage only when it is used #13

Merged
merged 1 commit into from
Jun 8, 2015
Merged

Initialize v1 and v2 storage only when it is used #13

merged 1 commit into from
Jun 8, 2015

Conversation

cbandy
Copy link
Contributor

@cbandy cbandy commented Jun 7, 2015

This costs a little bit, but it makes it possible to use this package for v3 and v4 without any available entropy. Network interfaces are only scanned when using v1 or v2. I don't know if these are interesting use cases, but here's the code!

Before:

BenchmarkNewV1   5000000               268 ns/op               0 B/op          0 allocs/op
BenchmarkNewV2   5000000               272 ns/op               0 B/op          0 allocs/op
BenchmarkNewV3   2000000               861 ns/op             144 B/op          4 allocs/op
BenchmarkNewV4   1000000              1841 ns/op              16 B/op          1 allocs/op
BenchmarkNewV5   2000000               916 ns/op             176 B/op          4 allocs/op

After:

BenchmarkNewV1   5000000               288 ns/op               0 B/op          0 allocs/op
BenchmarkNewV2   5000000               286 ns/op               0 B/op          0 allocs/op
BenchmarkNewV3   2000000               866 ns/op             144 B/op          4 allocs/op
BenchmarkNewV4   1000000              1853 ns/op              16 B/op          1 allocs/op
BenchmarkNewV5   2000000               916 ns/op             176 B/op          4 allocs/op

satori added a commit that referenced this pull request Jun 8, 2015
Initialize v1 and v2 storage only when it is used
@satori satori merged commit 79765f7 into satori:master Jun 8, 2015
@satori
Copy link
Owner

satori commented Jun 8, 2015

Great! Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants