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

lease: remove unnecessary O(log N) heap operation when nothing is expiry #9519

Merged
merged 4 commits into from
Apr 3, 2018

Conversation

gyuho
Copy link
Contributor

@gyuho gyuho commented Apr 2, 2018

Since heap is already sorted, we can just check first element
to see if anything is expiry, rather than popping and pushing
it back. If nothing is expiry, pop operation O(log N) is unnecessary.

/cc @xiang90 @mgates @jcalvert

ref. #9418.

No need to have "lease" in field name.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Since heap is already sorted, we can just check first element
to see if anything is expiry, rather than popping and pushing
it back. If nothing is expiry, pop operation is unnecessary.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@2aa3dec). Click here to learn what that means.
The diff coverage is 90.47%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #9519   +/-   ##
=========================================
  Coverage          ?   72.52%           
=========================================
  Files             ?      367           
  Lines             ?    31240           
  Branches          ?        0           
=========================================
  Hits              ?    22656           
  Misses            ?     6955           
  Partials          ?     1629
Impacted Files Coverage Δ
lease/lease_queue.go 100% <ø> (ø)
lease/lessor.go 87.22% <90.47%> (ø)

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 2aa3dec...9c62d7b. Read the comment docs.

@gyuho gyuho merged commit d8dc29e into etcd-io:master Apr 3, 2018
@gyuho gyuho deleted the heap branch April 3, 2018 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants