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

write batch with capacity #1846

Merged
merged 4 commits into from May 18, 2017
Merged

Conversation

zhangjinpeng87
Copy link
Member

@siddontang
Copy link
Contributor

I suggest doing a benchmark and profile the memory allocation cost.

@@ -56,6 +56,7 @@ use super::metrics::*;
use super::local_metrics::{RaftReadyMetrics, RaftMessageMetrics, RaftProposeMetrics, RaftMetrics};

const TRANSFER_LEADER_ALLOW_LOG_LAG: u64 = 10;
const DEFAULT_APPEND_WB_SIZE: usize = 32 * 1024;
Copy link
Member

Choose a reason for hiding this comment

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

Why 32 * 1024?

@zhangjinpeng87
Copy link
Member Author

zhangjinpeng87 commented May 18, 2017

test writebatch::bench_writebatch::bench_writebatch_with_capacity    ... bench:       6,117 ns/iter (+/- 3,253)
test writebatch::bench_writebatch::bench_writebatch_without_capacity ... bench:       7,501 ns/iter (+/- 3,714)

Copy link
Contributor

@siddontang siddontang left a comment

Choose a reason for hiding this comment

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

LGTM

@zhangjinpeng87
Copy link
Member Author

PTAL

@BusyJay
Copy link
Member

BusyJay commented May 18, 2017

LGTM

@zhangjinpeng87 zhangjinpeng87 merged commit 489bba0 into master May 18, 2017
@zhangjinpeng87 zhangjinpeng87 deleted the zhangjinpeng/wb-with-capacity branch May 18, 2017 05:01
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.

None yet

3 participants