-
Notifications
You must be signed in to change notification settings - Fork 218
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
improve the performance of imported_keylist deconstruction #239
base: master
Are you sure you want to change the base?
Conversation
obj_gen.cpp
Outdated
while (!m_keys.empty()) { | ||
free(m_keys.front()); | ||
m_keys.erase(m_keys.begin()); | ||
for (key* k : m_keys) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's stick to the old style for old compiler compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I just changed the loop style.
obj_gen.cpp
Outdated
m_keys.erase(m_keys.begin()); | ||
} | ||
free(m_keys.front()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it will work... we are not removing any element from the array... so m_keys.empty()
always return false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for that mistake. There must be something wrong with my brain yesterday.
I just change the code style with a for loop.
17956d6
to
ff46b67
Compare
Test command./memtier_benchmark -p 6379 -t 2 -c 8 -n 500000 --ratio 1:0 --data-import ./dump100.csv Test result:
Supplement |
ff46b67
to
fee7875
Compare
@filipecosta90 hi could you please check this PR? I think it is ready to be merged |
fee7875
to
efcaa4e
Compare
Problem
When I run
memtier_benchmark
with--data-import
(including 500000 keys), it took a long time to quit after benchmark finished.With pstack, I found the process was waiting in
~imported_keylist()
Solution
erase()
one by one for a dead vector wastes some time. So I replacederase()
withclear()
, which makes it much faster.