Perf: Optimize function TwoLevelIterator::Seek in table/two_level_iterator.cc #1282
+4
−2
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
TwoLevelIterator::Seek
intable/two_level_iterator.cc
.Performance was measured using the project's standard benchmark tools. Out of
22
test cases, the optimization achieves a maximum improvement of 68.56% while guaranteeing no regression exceeds 1.56% in any other case.Test Plan
db_bench
tool. The automated script covers several key aspects of database performance, ensuring no regressions and evaluating the impact of the changes under various workloads. The specific benchmarks executed include: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:
section_1_core_read_write.1_2_fillrandom.throughput_mb_s
-0.23%
section_1_core_read_write.1_6_overwrite.throughput_mb_s
0.12%
section_1_core_read_write.1_3_readseq.throughput_mb_s
0.92%
section_1_core_read_write.1_1_fillseq.throughput_mb_s
-0.26%
section_1_core_read_write.1_6_fillrandom.throughput_mb_s
0.42%
section_1_core_read_write.1_2_fillrandom.micros_per_op
-0.31%
section_1_core_read_write.1_6_overwrite.micros_per_op
0.13%
section_1_core_read_write.1_4_readrandom.micros_per_op
-0.46%
section_1_core_read_write.1_5_seekrandom.micros_per_op
68.56%
section_1_core_read_write.1_3_readseq.micros_per_op
0.96%
section_1_core_read_write.1_1_fillseq.micros_per_op
-0.38%
section_1_core_read_write.1_6_fillrandom.micros_per_op
0.42%
section_2_concurrent_compression.2_2_fillrandom.micros_per_op
1.67%
section_2_concurrent_compression.2_1_readwhilewriting.micros_per_op
5.54%
section_2_concurrent_compression.2_2_compact.micros_per_op
1.30%
section_2_concurrent_compression.2_3_fillsync.micros_per_op
-1.56%
section_2_concurrent_compression.2_2_fillrandom.throughput_mb_s
1.71%
section_2_concurrent_compression.2_3_fillsync.throughput_mb_s
0.00%
section_3_config_comparison.3_1_fillrandom_small.micros_per_op
0.38%
section_3_config_comparison.3_2_fillrandom_medium.micros_per_op
-0.20%
section_3_config_comparison.3_1_fillrandom_small.throughput_mb_s
0.35%
section_3_config_comparison.3_2_fillrandom_medium.throughput_mb_s
-0.23%