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

使用zset(skiplist)时,发现其remove,incr, updateScore比想象中的慢非常多 #192

Open
chgz opened this issue Oct 13, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@chgz
Copy link

chgz commented Oct 13, 2023

Operating System

Windows 10

Go Version

1.21

Package Version

latest

Affected Packages

collection/zset

Expected Behavior

使用zset(skiplist)时,发现其remove,incr, updateScore比想象中的慢非常多。
初步看了下cpu开销,发现lessthan的比较函数执行次数远高于 incr, zrem的复杂度M*log(N)的次数量级。
比如添加1w个元素耗时lessthan执行次数:221038,更新这1w个元素要lessthan执行次数: 98797380
把测试数据增加到10w个,lessthan次数到:2748187, 等了很久都没等到10w个元素更新完成(手动停止了)

Actual Behavior

Reproduction Steps

创建一个zset,

  1. 添加10000个元素
  2. incr 10000个元素
  3. 删除这10000个元素

Other Information

No response

@chgz chgz added the bug Something isn't working label Oct 13, 2023
@chgz
Copy link
Author

chgz commented Oct 13, 2023

测试的分值,是0-10000的随机值

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant