find_best_split_size

Function find_best_split_size 

Source
pub fn find_best_split_size(
    total_items: usize,
    min_size: usize,
    max_size: usize,
) -> usize
Expand description

Find the best split size for dividing a total number of items given a range of sizes.

Searches from starting with min to max to ideally find an even split with no remainders. Otherwise, choose a size that minimizes the remainder favoring smaller sizes.

§Arguments

  • total_items - Total number of items to split
  • min_size - Minimum size per split
  • max_size - Maximum size per split

§Returns

The optimal partition size