Perf: Optimize funtion DBImpl::Write in db/db_impl/db_impl_write.cc #13941
+3
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR optimizes the performance of the function
DBImpl::Write
indb/db_impl/db_impl_write.cc
.Performance was measured using the project's standard benchmark tools. Out of
2
test cases, the optimization achieves a maximum improvement of 5.04% while guaranteeing no regression exceeds 0.23% in any other case.Test Plan
./db_bench --benchmarks=fillseq,readrandom --db=/tmp/rocksdb_test --num=1000000
Performance Evaluation & Results
Testing Protocol:
(new_value - old_value) / old_value * 100%
if a higher value is better (e.g., throughput), or(old_value - new_value) / new_value * 100%
if a lower value is better (e.g., latency). A positive percentage indicates a performance gain.Results:
readrandom_mb_change
-0.23%
fillseq_mb_change
5.04%