Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
9.2
-
None
-
New
Description
I notice LogMergePolicy#findMerges will always calculate max level on the right side when find the next segments to merge.
I think we could calculate the max levels only once, and when we need the max level, we could simply
float maxLevel = maxLevels[start];
and the precomputed code looks like below, compare each level in levels from right to left
float[] maxLevels = new float[numMergeableSegments + 1]; maxLevels[numMergeableSegments] = -1.0f; for (int i = numMergeableSegments - 1; i >= 0; i--) { maxLevels[i] = Math.max(levels.get(i).level, maxLevels[i + 1]); }
Attachments
Issue Links
- links to