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

切片实现的支持泛型的小根堆,简单封装了一下internal里面的红黑树 #218

Merged
merged 5 commits into from
Sep 25, 2023

Conversation

KelipuTe
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Sep 23, 2023

Codecov Report

Merging #218 (b72a1bd) into dev (046debe) will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##              dev     #218      +/-   ##
==========================================
+ Coverage   95.89%   95.93%   +0.04%     
==========================================
  Files          54       56       +2     
  Lines        3046     3077      +31     
==========================================
+ Hits         2921     2952      +31     
  Misses         96       96              
  Partials       29       29              
Files Changed Coverage Δ
queue/priority_queue.go 100.00% <100.00%> (ø)
tree/red_black_tree.go 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@flycash flycash left a comment

Choose a reason for hiding this comment

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

这里我认为是没有必要提供一个新的 MinHeap 的。在你准备的优先级淘汰缓存里面,应该只是需要一个优先级队列。所以你可以尝试暴露 internal 里面的 PriorityQueue。PriorityQueue 和 MinHeap 的实现基本上是一样的。

tree/red_black_tree.go Outdated Show resolved Hide resolved
tree/red_black_tree.go Outdated Show resolved Hide resolved
@KelipuTe
Copy link
Contributor Author

KelipuTe commented Sep 25, 2023

我换成优先级队列看看。好像确实差不多,先map映射然后再优先级队列入队,效果和这个小根堆的效果是一样的,也可以满足随机删除缓存时清理优先级数据的需求。不过这玩意也要先从internal里面放出来。

@flycash
Copy link
Contributor

flycash commented Sep 25, 2023

大哥!你的 license 和 format go code 都失败了!运行一下 make check

@flycash
Copy link
Contributor

flycash commented Sep 25, 2023

复制粘贴一下证书。

KelipuTe and others added 2 commits September 25, 2023 22:51
Signed-off-by: Ming Deng <mingflycash@gmail.com>
@flycash flycash merged commit c5bfbd4 into ecodeclub:dev Sep 25, 2023
6 checks passed
@flycash
Copy link
Contributor

flycash commented Sep 25, 2023

在 ecache 里面使用 dev 分支,等 ecache 通过考验,我会发布 0.0.9

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