Skip to content

Commit

Permalink
disable compaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Or Friedmann committed Feb 5, 2024
1 parent 7ecaaee commit dc836e1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions examples/simple_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ int main() {
Options options;
options.create_if_missing = true;
// Disable RocksDB background compaction.
options.disable_auto_compactions = true;
DB* db = nullptr;
ROCKSDB_NAMESPACE::DestroyDB(kDBPath, options);
options.compression = ROCKSDB_NAMESPACE::CompressionType::kNoCompression;
Expand Down Expand Up @@ -82,15 +83,15 @@ int main() {
iter->Seek(std::string((char *)&key, 8));
delete iter;
}
printf("time to get 1000 keys after delete is %lu micros\n", clock->NowMicros() - t);
printf("time to get 10000 keys after delete is %lu micros\n", clock->NowMicros() - t);
t = clock->NowMicros();

for (uint32_t i = 0; i < 10000 ; i++) {
auto iter = db->NewIterator(ReadOptions());
iter->Seek(std::string((char *)&start_key, 8));
delete iter;
}
printf("time to get 1000 keys after range delete is %lu micros\n", clock->NowMicros() -t);
printf("time to get 10000 keys after range delete is %lu micros\n", clock->NowMicros() -t);
t = clock->NowMicros();
auto delete_range_start = + prime/10 + 100 + prime/10;
for (uint32_t i = 0; i < 10000 ; i++) {
Expand All @@ -99,7 +100,7 @@ int main() {
iter->Seek(std::string((char *)&start_key, 8));
delete iter;
}
printf("time to get 1000 keys with no delete is %lu micros\n", clock->NowMicros() -t);
printf("time to get 10000 keys with no delete is %lu micros\n", clock->NowMicros() -t);



Expand Down

0 comments on commit dc836e1

Please sign in to comment.