Browse Source

baseline benchmark

baseline
ArcueidType 8 months ago
parent
commit
a9a8a8d73d
5 changed files with 32 additions and 7 deletions
  1. +6
    -0
      .idea/misc.xml
  2. +8
    -3
      benchmarks/db_bench.cc
  3. +14
    -3
      db/db_impl.cc
  4. +2
    -0
      db/filename.cc
  5. +2
    -1
      db/filename.h

+ 6
- 0
.idea/misc.xml View File

@ -1,5 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BackendCodeEditorMiscSettings">
<option name="/Default/RiderDebugger/RiderRestoreDecompile/RestoreDecompileSetting/@EntryValue" value="false" type="bool" />
<option name="/Default/Housekeeping/GlobalSettingsUpgraded/IsUpgraded/@EntryValue" value="true" type="bool" />
<option name="/Default/Housekeeping/FeatureSuggestion/FeatureSuggestionManager/DisabledSuggesters/=SwitchToGoToActionSuggester/@EntryIndexedValue" value="true" type="bool" />
<option name="/Default/Environment/Hierarchy/GeneratedFilesCacheKey/Timestamp/@EntryValue" value="5" type="long" />
</component>
<component name="CMakePythonSetting">
<option name="pythonIntegrationState" value="YES" />
</component>

+ 8
- 3
benchmarks/db_bench.cc View File

@ -74,7 +74,7 @@ static int FLAGS_reads = -1;
static int FLAGS_threads = 1;
// Size of each value
static int FLAGS_value_size = 100;
static int FLAGS_value_size = 1000;
// Arrange to generate values that shrink to this fraction of
// their original size after compression
@ -852,8 +852,13 @@ class Benchmark {
for (int j = 0; j < entries_per_batch_; j++) {
const int k = seq ? i + j : thread->rand.Uniform(FLAGS_num);
key.Set(k);
batch.Put(key.slice(), gen.Generate(value_size_));
bytes += value_size_ + key.slice().size();
auto value = gen.Generate(value_size_);
FieldArray field_array = {
{"1", value.ToString()},
};
auto encoded_value = Fields(field_array).Serialize();
batch.Put(key.slice(), Slice(encoded_value));
bytes += encoded_value.size() + key.slice().size();
thread->stats.FinishedSingleOp();
}
s = db_->Write(write_options_, &batch);

+ 14
- 3
db/db_impl.cc View File

@ -257,6 +257,9 @@ void DBImpl::RemoveObsoleteFiles() {
case kTableFile:
keep = (live.find(number) != live.end());
break;
case kVTableFile:
keep = (live.find(number) != live.end());
break;
case kTempFile:
// Any temp files that are currently being written to must
// be recorded in pending_outputs_, which is inserted into "live"
@ -1153,8 +1156,12 @@ Status DBImpl::Get(const ReadOptions& options, const Slice& key,
s = current->Get(options, lkey, value, &stats);
have_stat_update = true;
}
auto fields = Fields(Slice(*value));
*value = fields["1"];
if (s.ok()) {
auto fields = Fields(Slice(*value));
*value = fields["1"];
} else {
*value = "";
}
mutex_.Lock();
}
@ -1203,7 +1210,11 @@ Status DBImpl::Get(const ReadOptions& options, const Slice& key,
s = current->Get(options, lkey, value, &stats);
have_stat_update = true;
}
*fields = Fields(Slice(*value));
if (s.ok()) {
*fields = Fields(Slice(*value));
} else {
*fields = Fields();
}
mutex_.Lock();
}

+ 2
- 0
db/filename.cc View File

@ -112,6 +112,8 @@ bool ParseFileName(const std::string& filename, uint64_t* number,
*type = kTableFile;
} else if (suffix == Slice(".dbtmp")) {
*type = kTempFile;
} else if (suffix == Slice(".vtb")) {
*type = kVTableFile;
} else {
return false;
}

+ 2
- 1
db/filename.h View File

@ -25,7 +25,8 @@ enum FileType {
kDescriptorFile,
kCurrentFile,
kTempFile,
kInfoLogFile // Either the current one, or an old one
kInfoLogFile, // Either the current one, or an old one
kVTableFile
};
// Return the name of the log file with the specified number

Loading…
Cancel
Save