~/bend-docscommunity

performance/drop_in_bang.bend checks

raw source on the hub · import bend-lint-rules@0.2.1.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.

4 imports
import Base
import bend-lint-api@0.2.1.0/linter/lint.bend as Lint
import bend-lint-api@0.2.1.0/shared/names.bend as Names
import ./gpu_fit.bend as GpuFit

Types

type Program source · line 19 · 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 24 · raw

@callee:String -> String

Functions =========

def visit source · line 29 · raw

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

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

def run source · line 60 · raw

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

def rule source · line 74 · raw

0xd69a1e32f167d67a827d0d362dfcf729/linter/lint.Rule