KernelCost.region_ns: def of stelliferous@0.0.2.0 Import: import stelliferous@0.0.2.0/kernel_cost.bend as KernelCost Lines 15-24 of stelliferous@0.0.2.0/kernel_cost.bend: https://jend.leeeet.dev/read.txt?path=stelliferous@0.0.2.0/kernel_cost.bend&start_line=15&end_line=24 import Base # The official runtime grows fork tasks and queues fork-free tasks for its # work round (monk_step, row_grow, cube_run). No fixed number of leaves can # be subtracted as already completed by growth. Price complete waves of at # most workers leaves, using the largest path (including clones) per wave. # This is a conservative scheduling estimate, not a bound on the runtime's # static ring distribution. Callers charge the two wake rounds separately. def region_ns(+workers: U32,+leaves: U32,+span: F32) -> F32: +pool = U32.max(workers,1) +waves = (leaves / pool + Bool.pick(U32,U32.is_zero((leaves % pool : U32)),0,1) : U32) (span * U32.to_f32(waves) : F32) Uses (10): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.pick https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.mul https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.div https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_zero https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.max https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.mod https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_f32