def faster

bend-lint-rules@0.2.0.0 · performance/gpu_fit.bend:216

import bend-lint-rules@0.2.0.0/performance/gpu_fit.bend as GpuFit
import Base

216def faster(+callee: String) -> String:
217  callee
218    ++ " forks over numbers only, so `"
219    ++ callee
220    ++ "!(..)` can run faster on the GPU, if the call is long: a discrete GPU costs a fixed 0.3 to 0.8 s to start, then numeric work is nearly free. GPU: measured 3.8x faster for a fork tree that took 3.6 s on the CPU, and 8x slower for one that took 0.06 s. CPU (`--gpu off`): not measured. JS: no GPU, so no change. Confidence: low, as it depends on how long this call runs, and on the machine. Add the `!` if this call takes over a second on the CPU, and time both; a fork before it in the same evaluation keeps it on the CPU (performance/bang_after_fork). If the call is short, or already runs under a `!` of a caller (a `!` in a `!` measured up to 4.6x slower), expect this finding."

Uses (2)

Used by (1)