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

Add benchmark tests #13

Merged
merged 6 commits into from
Oct 2, 2019
Merged

Add benchmark tests #13

merged 6 commits into from
Oct 2, 2019

Conversation

kevburnsjr
Copy link
Owner

@kevburnsjr kevburnsjr commented Oct 1, 2019

$ go test -bench=. -benchmem
goos: linux
goarch: amd64
pkg: github.com/kevburnsjr/microcache
BenchmarkHits-12                            827476   1449 ns/op    678 B/op   14 allocs/op
BenchmarkNocache-12                        1968576    613 ns/op    312 B/op    6 allocs/op
BenchmarkMisses-12                          307652   3890 ns/op   1765 B/op   37 allocs/op
BenchmarkCompression1kHits-12               648564   1928 ns/op   1384 B/op   15 allocs/op
BenchmarkCompression1kNocache-12           1965351    611 ns/op    312 B/op    6 allocs/op
BenchmarkCompression1kMisses-12             232980   5119 ns/op   3365 B/op   39 allocs/op
BenchmarkParallelCompression1kHits-12      2525994    511 ns/op   1383 B/op   15 allocs/op
BenchmarkParallelCompression1kNocache-12   3876728    335 ns/op    312 B/op    6 allocs/op
BenchmarkParallelCompression1kMisses-12     666580   2226 ns/op   3326 B/op   38 allocs/op
PASS
ok      github.com/kevburnsjr/microcache        7.188s

@erikdubbelboer
Copy link
Contributor

You could maybe add a benchmark that does parallel requests using B.RunParallel. And a benchmark where the cache fills up and old entries have to be evicted to add new ones.

@kevburnsjr
Copy link
Owner Author

You could maybe add a benchmark that does parallel requests using B.RunParallel. And a benchmark where the cache fills up and old entries have to be evicted to add new ones.

Good idea. Done.

@kevburnsjr kevburnsjr merged commit f129a92 into master Oct 2, 2019
@kevburnsjr kevburnsjr deleted the benchmarks branch October 2, 2019 23:03
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.

None yet

2 participants