more fixes

This commit is contained in:
serxa 2024-12-04 14:45:37 +00:00
parent 2e0821e739
commit 55f658ad78
4 changed files with 8 additions and 4 deletions

View File

@ -77,7 +77,7 @@ export function* floatLayerMerges({insertPartSize, layerBases})
let best_layer = layerBases.length;
const active_parts = mt.sortedActiveParts();
let prev_part = null;
for (let begin = 0; begin < active_parts.length - 2; begin++)
for (let begin = 0; begin <= active_parts.length - 2; begin++)
{
const begin_part = active_parts[begin];
if (begin_part.merging)

View File

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Merge Selector Lab</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://d3js.org/d3.v7.min.js"></script>

View File

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Merge Selector Lab</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://d3js.org/d3.v7.min.js"></script>

View File

@ -1,4 +1,4 @@
function layerFuncForBases(insertPartSize, layerBases)
function layerFuncForIntegerBases(insertPartSize, layerBases)
{
let sizes = [insertPartSize];
for (const base of layerBases)
@ -37,7 +37,7 @@ function layerFuncForBases(insertPartSize, layerBases)
// Lower layers get absolute priority over higher layers.
export function* integerLayerMerges({insertPartSize, layerBases})
{
const layerFunc = layerFuncForBases(insertPartSize, layerBases);
const layerFunc = layerFuncForIntegerBases(insertPartSize, layerBases);
const mt = yield {type: 'getMergeTree'};
const settings = {
@ -53,11 +53,13 @@ export function* integerLayerMerges({insertPartSize, layerBases})
let best_layer = Infinity;
for (const cur_range of mt.getRangesForMerge())
{
for (let begin = 0; begin < cur_range.length - settings.min_parts; begin++)
for (let begin = 0; begin <= cur_range.length - settings.min_parts; begin++)
{
const layer = layerFunc(cur_range[begin].bytes);
if (layer >= best_layer)
continue; // We already have parts to merge on this layer
if (layer >= layerBases.length)
continue; // Merging futher not requested
const base = layerBases[layer];
const end = begin + base;
if (end > cur_range.length)