def Drv.inputs.par

bend-kube-runtime@0.2.0.0 · src/runtime.bend:84

import bend-kube-runtime@0.2.0.0/src/runtime.bend as Runtime
import Base
import bend-kube-runtime@0.2.0.0/src/watcher.bend as W

84# The same, with the lines decoded and parsed in parallel: each line is
85# its own JSON document, so the halves split (to depth levels, up to 2^depth
86# tasks) run as Bend parallel calls, on every core.
87def Drv.inputs.par(+depth: Nat, +ls: List<&2, List<&2, U32>>) -> List<&2, W.Input>:
88  match depth:
89    case 0n:
90      Drv.inputs(ls)
91    case 1n+d:
92      +half = Nat.div(List.length(&2, List<&2, U32>, ls), 2n)
93      a b = Drv.inputs.par(d, List.take(&2, List<&2, U32>, ls, half)) Drv.inputs.par(d, List.drop(&2, List<&2, U32>, ls, half))
94      List.append(&2, W.Input, a, b)

Uses (10)

Used by (1)