Performance
The decoder runs on the same thread as the UI, so the only number that matters is how long a frame takes. Everything below measures that in this browser, on this device, right now.
Decoder benchmark
Decodes one generated sample of every symbology, centred in a gray frame of the chosen size, in a loop with no camera involved, so the result isolates the managed pipeline from capture and compositing. The decoder runs with the live camera defaults and the chosen formats; a sample whose symbology is not enabled shows what that frame costs when nothing in it is looked for.
Median, Best and Worst are the time one frame took over the iterations, after a warm-up pass; Throughput is the frames a second the median allows. The empty frame is the cost of every frame the camera sends while nothing is in view - usually most of them.
Live camera cost
The same pipeline on real camera frames, with duplicate suppression off so every decoded
frame counts. Turn the knobs and watch the stage split move. The panel under the scanner is fed by
OnDiagnostics, raised at most twice a second with a BbScanDiagnostics:
Frame is the time the last frame took, Headroom the frames a second that time would
allow, Decoded size the image the decoders actually saw after the region and any
downsampling, and Scan lines how many lines were tried for linear symbols. The bar splits the
frame between grayscale conversion, binarisation, matrix detection and linear scanning; the count
below it is FramesDecoded and FramesWithSymbol.
Frame diagnostics
Knobs
The BbScannerOptions knobs - scan lines, downsampling, try harder, inverted
symbols - are in the playground, beside the same diagnostics.
What costs what
| Setting | Effect | When to change it |
|---|---|---|
| MaxProcessingSize | Quadratic. The dominant control. | Lower until the smallest symbol you care about stops decoding, then go one step back. |
| Formats | Linear in the number of decoders that run. | Always. Most applications need one or two symbologies. |
| Region | Proportional to the area kept. | Whenever the interface asks the user to aim. |
| MaxScanLines | Linear, and only for linear symbologies. | Lower for aimed scanning, raise for hands-off scanning. |
| TryHarder | Roughly triples matrix detection cost. | Still images only; it is off for live frames by design. |
| AllowInverted | Doubles the cost of frames that find nothing. | Only when white-on-black symbols are expected. |
| DownsampleFactor | Quadratic, applied inside the grayscale pass. | When frames arrive larger than you asked for and you cannot change the source. |
| TryVerticalLines | About as much as the row pass, on frames that find nothing. | Turn off when linear symbols are always presented level. |
| TryReversedRows | Cheap. | Leave on: it is what reads a symbol held upside down. |
| MaxSymbolsPerFrame | One more matrix pass than reading a single symbol: the pass that finds nothing else. | Only when several codes are wanted at once. |
| TargetFrameRate | Linear in battery and main thread time; no effect on a single frame. | Lower on slow devices; above about twenty rarely helps. |