performance/drop_in_bang.bend fails
raw source on the hub · import bend-lint-rules@0.1.0.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.1.0.0/linter/lint.bend as Lint import bend-lint-api@0.1.0.0/shared/names.bend as Names import ./gpu_fit.bend as GpuFit
The reader could not load this file (at 0x2b0a0dcada30f71a8eb4ec2e148b9279/linter/lint.bend:522). What bend.ts says:
Error:
- expected : a fresh constructor name (duplicate declaration: Text)
- observed : 'Text'
Location:
521 | Flag{on: Bool}
522>| Text{text: String}
| ^^^^
523 |