Skip to content
Browse files

bplus: decrease page size

* bench: do compaction each 100000 inserts
  • Loading branch information...
1 parent 4651646 commit 80624b11c7dd632534634c93b359c8ec6ec59f9f @indutny committed Feb 8, 2012
Showing with 17 additions and 8 deletions.
  1. +1 −1 src/bplus.c
  2. +16 −7 test/bench-basic.cc
View
2 src/bplus.c
@@ -463,7 +463,7 @@ int bp__tree_write_head(bp__writer_t* w, void* data) {
if (t->head.page == NULL) {
/* TODO: page size should be configurable */
- t->head.page_size = 64;
+ t->head.page_size = 24;
/* Create empty leaf page */
ret = bp__page_create(t, kLeaf, 0, 1, &t->head.page);
View
23 test/bench-basic.cc
@@ -5,7 +5,7 @@ TEST_START("basic benchmark", "basic-bench")
const int num = 500000;
const int value_len = 1000;
const int delta = 20000;
- int i, start;
+ int i, offset, start;
char keys[num][10];
char value[value_len];
@@ -29,13 +29,22 @@ TEST_START("basic benchmark", "basic-bench")
}
BENCH_END(write, delta)
- BENCH_START(read, start + delta)
- for (i = 0; i < start + delta; i++) {
- char* value1;
- bp_gets(&db, keys[i], &value1);
- free(value1);
+ offset = 0;
+ for (offset = 0; offset <= start; offset += delta) {
+ BENCH_START(read, delta)
+ for (i = offset; i < offset + delta; i++) {
+ char* value1;
+ bp_gets(&db, keys[i], &value1);
+ free(value1);
+ }
+ BENCH_END(read, delta)
+ }
+
+ if (start % 100000 == 0) {
+ BENCH_START(compact, 0)
+ bp_compact(&db);
+ BENCH_END(compact, 0)
}
- BENCH_END(read, start + delta)
}
BENCH_START(compact, 0)

0 comments on commit 80624b1

Please sign in to comment.
Something went wrong with that request. Please try again.