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

cache: remove prefetch closure #3353

Merged
merged 1 commit into from Oct 3, 2019

Conversation

@miekg
Copy link
Member

miekg commented Oct 3, 2019

cache: move goroutine closure to separate function to save memory

The goroutine closure was causing objects to be heap allocated.  Moving
it to a separate function fixes that.

```benchmark                                old ns/op     new ns/op     delta
BenchmarkCacheResponse/NoPrefetch-12     773           713           -7.76%
BenchmarkCacheResponse/Prefetch-12       878           837           -4.67%
BenchmarkHash-12                         9.17          9.18          +0.11%

benchmark                                old allocs     new allocs     delta
BenchmarkCacheResponse/NoPrefetch-12     9              8              -11.11%
BenchmarkCacheResponse/Prefetch-12       9              8              -11.11%
BenchmarkHash-12                         0              0              +0.00%

benchmark                                old bytes     new bytes     delta
BenchmarkCacheResponse/NoPrefetch-12     471           327           -30.57%
BenchmarkCacheResponse/Prefetch-12       471           327           -30.57%
BenchmarkHash-12                         0             0             +0.00%
```

Signed-off-by: Charlie Vieth <charlie.vieth@gmail.com>
Signed-off-by: Miek Gieben <miek@miek.nl>
@corbot corbot bot requested a review from grobie Oct 3, 2019
@corbot

This comment has been minimized.

Copy link

corbot bot commented Oct 3, 2019

Thank you for your contribution. I've just checked the OWNERS files to find a suitable reviewer. This search was successful and I've asked grobie (via plugin/cache/OWNERS) for a review.
Note this is not an exclusive request. Anyone is free to provide a review of this pull request.

If you have questions or suggestions for this bot, please file an issue against the miekg/dreck repository.

The bot understands the commands that are listed here.

@miekg

This comment has been minimized.

Copy link
Member Author

miekg commented Oct 3, 2019

ok, right diff. But horrible commit history

The goroutine closure was causing objects to be heap allocated.  Moving
it to a separate function fixes that.

```benchmark                                old ns/op     new ns/op     delta
BenchmarkCacheResponse/NoPrefetch-12     773           713           -7.76%
BenchmarkCacheResponse/Prefetch-12       878           837           -4.67%
BenchmarkHash-12                         9.17          9.18          +0.11%

benchmark                                old allocs     new allocs     delta
BenchmarkCacheResponse/NoPrefetch-12     9              8              -11.11%
BenchmarkCacheResponse/Prefetch-12       9              8              -11.11%
BenchmarkHash-12                         0              0              +0.00%

benchmark                                old bytes     new bytes     delta
BenchmarkCacheResponse/NoPrefetch-12     471           327           -30.57%
BenchmarkCacheResponse/Prefetch-12       471           327           -30.57%
BenchmarkHash-12                         0             0             +0.00%
```

Signed-off-by: Charlie Vieth <charlie.vieth@gmail.com>
Signed-off-by: Miek Gieben <miek@miek.nl>
@miekg miekg force-pushed the prefetch-func branch from 1ec9cfe to 252db27 Oct 3, 2019
@miekg miekg changed the title bliep cache: remove prefetch closure Oct 3, 2019
@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Oct 3, 2019

Codecov Report

Merging #3353 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3353      +/-   ##
==========================================
+ Coverage   55.24%   55.28%   +0.04%     
==========================================
  Files         217      217              
  Lines       10780    10783       +3     
==========================================
+ Hits         5955     5961       +6     
+ Misses       4368     4366       -2     
+ Partials      457      456       -1
Impacted Files Coverage Δ
plugin/cache/cache.go 75.49% <ø> (ø) ⬆️
plugin/cache/handler.go 89.13% <100%> (+0.75%) ⬆️
plugin/clouddns/clouddns.go 85.45% <0%> (+2.72%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aa96d6b...252db27. Read the comment docs.

@miekg

This comment has been minimized.

Copy link
Member Author

miekg commented Oct 3, 2019

/lgtm

@corbot
corbot bot approved these changes Oct 3, 2019
Copy link

corbot bot left a comment

LGTM by miekg

@miekg miekg merged commit f8551df into master Oct 3, 2019
5 checks passed
5 checks passed
DCO DCO
Details
ci/circleci: kubernetes-tests Your tests passed on CircleCI!
Details
codecov/project 55.28% (target 50%)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
stickler-ci No lint errors found.
@corbot corbot bot deleted the prefetch-func branch Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.