You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The formula behind from_ordset/from_orddict/from_ordered_list was never
written down, so record what it computes and why.
xb5_utils:bulk_construction_params/1 counts in base 4 because bulk
construction targets nodes of 3 keys and 4 children, not the maximum 4 and 5 -
the density the README argues for under "Key density". From that:
- BatchSize - 1 is 4^(h+1) - 1, the size of a perfect subtree of 3-key,
4-child nodes, handed to each fully loaded child.
- BatchOffset is (4^(h+1) - 1) / 3, at once that subtree's node count and
the smallest S reaching this level. The two coincide only because the
target density is exactly 3.
Confirmed against structural_stats: sizes of 4^(h+1) - 1 give exactly 3.000
keys per node over (4^(h+1) - 1) / 3 nodes, and the worst cases are the
BatchOffsets themselves, where a level is forced and the root is left an
INTERNAL1.
Document the consuming half above xb5_sets_node:from_ordset_recur/5 - the
quotient picking each node's arity, INTERNAL1 staying root-only as deletion
also requires, and the tail split. The three-quarter cap in
from_ordset_right_children_sizes/2 is recorded as tuned rather than derived,
which is what it is. xb5_trees_node and xb5_bag_node point at both places
instead of repeating them.
Comments only, no change to compiled behaviour.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0 commit comments