~/bend-docscommunity

performance/drop_in_bang.bend checks

raw source on the hub · import bend-lint-rules@0.3.5.0/performance/drop_in_bang.bend as Drop_in_bang

performance/drop_in_bang: a ! call of a definition that returns Unit: Base's Image.drop, Image.free or Image.sink, or a definition of the program declared -> Unit. A pure definition that returns Unit does nothing but free what it receives, and a GPU frees slower than its CPU. Heuristics: measured on a discrete GPU (CUDA), 30 frames that each dropped a 1M-leaf image with Image.drop! took 1.55 s, against 0.10 s with Image.drop (0.104 s against 0.094 s with --gpu off). "bend guide shaders" measured freeing Bend's slash boss scene in a bang at 12.9 ms a frame, against 8.0 ms, on an Apple M-series GPU, whose memory is unified: the GPU loses on both kinds of memory. The JS lane has no GPU. A return type written another way (an alias of Unit) is not known.

5 imports
import Base
import bend-lint-api@0.3.5.0/linter/api/impl.bend as LintImpl
import bend-lint-api@0.3.5.0/linter/api/spec.bend as Lint
import bend-lint-api@0.3.5.0/shared.bend as Shared
import ./gpu_fit.bend as GpuFit

Types

type Program source · line 20 · raw

Data

What judging a file's calls reads: the program's definitions, by the name the check gives them, and where the file writes !(.

Definitions

def message source · line 25 · raw

@callee:String -> String

Functions =========

def visit source · line 30 · raw

@+program:Program -> @+path:List<&2, 0x94bdd21968f0b8ad8c1be0e7e2b606a0/linter/api/spec.Above> -> @+node:0x94bdd21968f0b8ad8c1be0e7e2b606a0/linter/api/spec.Node -> List<&2, 0x94bdd21968f0b8ad8c1be0e7e2b606a0/linter/api/spec.Finding>

The finding about an application below path, if it is a ! call that only frees.

def run source · line 61 · raw

@+here:0x94bdd21968f0b8ad8c1be0e7e2b606a0/linter/api/spec.Here -> 0x94bdd21968f0b8ad8c1be0e7e2b606a0/linter/api/spec.Ask(List<&2, 0x94bdd21968f0b8ad8c1be0e7e2b606a0/linter/api/spec.Finding>)

def rule source · line 75 · raw

0x94bdd21968f0b8ad8c1be0e7e2b606a0/linter/api/spec.Rule