ZXing WASM vs. Dynamsoft Barcode Reader: A JavaScript Barcode Benchmark on 8,000 Synthetic Images
Need a license key to run the code in this tutorial?
Get a 30-day free trial licenseA web scanner that reads a clean QR code can still stall on a rotated parcel label, a low-contrast hang tag, or a frame carrying sixteen symbols. This benchmark scores the open-source zxing-wasm package (3.1.2, the ZXing-C++ core compiled to WebAssembly) and Dynamsoft Barcode Reader (dynamsoft-barcode-reader-bundle 11.6.5000) over 8,000 synthetic JPEGs from the Dynamsoft synthetic barcode corpus — 11,372 annotated symbols, 24 symbologies, 36 reusable background scenes, and 200 background-only controls.
Every image is fetched once, decoded into an ImageBitmap, and painted onto one shared canvas that both readers see. Every decode result ships with the project, and because the C++ and Python articles score the identical verified manifest with the same matching rules, the three read as one controlled experiment: unchanged input, a different language/runtime binding. On this run, Dynamsoft Barcode Reader returned 6,496 exact images (81.20%) against 3,851 (48.14%) for zxing-wasm.

What you’ll build: A browser-driven JavaScript benchmark that streams the synthetic corpus through a Node collector, times zxing-wasm and Dynamsoft’s CaptureVisionRouter on identical canvas pixels, validates the raw records, and ships a self-contained HTML report.
This article is Part 3 in a 3-Part Series.
Key Takeaways
- The corpus holds 8,000 JPEGs, 11,372 annotated symbols, 24 symbologies, and 36 background scenes, including 200 controls where an empty response is correct.
- Each image is fetched once, decoded into an
ImageBitmap, and painted onto a shared canvas; the fetch and bitmap-decode stage is recorded separately and never enters the decode clock. - A correct image needs a one-to-one match for every expected format and payload with no extra predictions. SDK errors count as no read.
- On one full pass with
ReadBarcodes_DefaultandBF_ALL, Dynamsoft Barcode Reader reached 6,496 / 8,000 exact images (81.20%) and 9,369 / 11,372 matched symbols (82.39% recall), reading 3,753 more annotated symbols than zxing-wasm. - zxing-wasm stays faster (25.63 ms mean versus 118.28 ms) but cannot decode 3,840 annotated symbols in postal, DotCode, MSI, and Pharmacode formats.
Common Developer Questions
What is a good zxing-wasm alternative for difficult barcodes?
Dynamsoft Barcode Reader is the stronger alternative in this benchmark when images are damaged, crowded, low-contrast, or mixed-symbology. On the corpus it returned 6,496 of 8,000 exact images (81.20%) against 3,851 (48.14%) for zxing-wasm, a lead of 2,645 images and 33.06 percentage points. The gap is largest exactly where “difficult” lives: on CODE_128 it read 433 of 470 symbols against zxing-wasm’s 288, on GS1-128 435 of 463 against 231, and on PDF_417 420 of 471 against 299. zxing-wasm remains a solid free baseline for clean, controlled input and is marginally ahead on Data Matrix.
When should I replace ZXing with a commercial barcode SDK?
Replace ZXing when the cost of a missed scan outweighs the license fee — production workflows where unread barcodes mean manual rework, failed checkouts, or lost parcels. In this run zxing-wasm left 3,832 images with no read against Dynamsoft’s 1,050, and it could not decode a single DotCode, POSTNET, KIX, MSI, Pharmacode, or Royal Mail symbol. Stay on ZXing when your input is controlled and clean, you need inspectable open source with no licensing, and roughly half the annotated symbols being unread is acceptable.
How do I migrate from zxing-wasm to Dynamsoft Barcode Reader?
Swap the decode call and keep the rest of your pipeline. Where zxing-wasm takes an ImageData or Blob and returns {format, text} objects, Dynamsoft uses a CaptureVisionRouter that accepts a canvas, image, or ImageData and returns barcode items with formatString and text. The migration section below shows both calls side by side; format names map almost one-to-one (EAN13 → EAN_13, QRCode → QR_CODE), and the payload text is directly comparable, so existing result-handling code carries over with a small format-normalization step.
Do the JavaScript results match the C++ and Python benchmarks on the same images?
Broadly yes on accuracy, with runtime-driven deltas. On the same 8,000 images, the browser bundle reached 81.20% exact images, against 83.93% for native C++ and 83.76% for Python. zxing-wasm 3.1.2 scored 48.14%, against 48.15% for ZXing-C++ 3.1.1 in both native runs. The roughly 2.5-point shortfall against the native runs comes from the image path (JPEG → ImageBitmap → RGBA canvas) and three Dynamsoft decode timeouts, not a different engine build; the WASM boundary shows up mostly in decode time.
Full Synthetic Benchmark Video
The recording walks through the corpus, the shared input path, and the final accuracy and speed numbers.
Prerequisites
- Node.js 18 or later (tested on Node v24.20.0) for the collector and static/image server
- A modern browser to run the WASM decoders; this run used headless Chrome 156
- The synthetic barcode corpus and its verified manifest (see Reproducibility)
- zxing-wasm 3.1.2 and dynamsoft-barcode-reader-bundle 11.6.5000, both loaded from pinned builds
- A valid Dynamsoft license key. Get a 30-day free trial license.
Start the collector/static server, pointing it at the corpus images:
node src/server.mjs `
--images "D:/datasets-from-dynamsoft/synthetic-benchmark/dataset-by-format/images" `
--manifest "D:/datasets-from-dynamsoft/synthetic-benchmark/dataset-by-format/manifest.jsonl" `
--output results/full `
--port 8790
Then open http://localhost:8790/, click Initialize SDKs, and click Run benchmark.
Step 1: Reuse the Verified Synthetic Manifest
This project does not regenerate the corpus. It loads the exact manifest.jsonl that ships with the corpus — 8,000 JPEGs carrying 11,372 annotated symbols, with the JPEG hash, seed, applied effects, and each symbol’s format, payload, and quadrilateral recorded per image. Reusing that manifest is what makes the three articles one controlled experiment: the C++, Python, and JavaScript runs all score the same images and the same matching rules.
| Corpus stage | Count | Role in the run |
|---|---|---|
| JPEG images | 8,000 | The denominator for each decoder, including controls |
| Annotated symbols | 11,372 | Ground truth formats and payloads |
| Symbologies | 24 | 13 linear, 4 postal, 7 2D |
| Background-only controls | 200 | An empty response is a correct image |
| Mixed-symbology images | 153 | Frames carrying several different formats |
| Positive images | 7,800 | Images with 1–16 annotated symbols |
| Decoder records | 16,000 | 8,000 images × 2 decoders × 1 measured pass |
Seeded layouts compose BWIPP-generated labels over reusable packaging, paper, fabric, and work-surface scenes, then apply isolated and combined capture effects: perspective, rotation, defocus and motion blur, low resolution and contrast, noise, JPEG compression, partial occlusion, uneven illumination, and glare. The generator bounds projected distortion, preserves QR and Micro QR finder patterns, and caps occlusion at 22% of a symbol. The figures describe this published corpus.
The server reads the manifest, hashes it, and streams each referenced image to the browser on request. The corpus generator and validation commands ship in the benchmark repository.
Step 2: Decode Images with Both JavaScript Readers
Each image is fetched once and decoded into an ImageBitmap, then painted onto a shared canvas. That stage is recorded separately as image_load_ns and never enters the decode statistics. Both readers then read the same pixels.
zxing-wasm takes an ImageData built from the canvas:
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
const results = await ZXingWASM.readBarcodes(imageData);
for (const r of results) {
const text = r.text; // decoded payload
const format = r.format; // e.g. "EAN13", "QRCode", "Code128"
}
Dynamsoft Barcode Reader is reached through the Capture Vision router’s barcode preset, reading the same canvas:
await Dynamsoft.License.LicenseManager.initLicense(licenseKey, true);
await Dynamsoft.Core.CoreModule.loadWasm(["DBR"]);
const cvRouter = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
const captured = await cvRouter.capture(
canvas,
Dynamsoft.CVR.EnumPresetTemplate.PT_READ_BARCODES
);
for (const item of captured.getItems()) {
const text = item.text; // decoded payload
const format = item.formatString; // e.g. "EAN_13", "QR_CODE", "CODE_128"
}
Only the reader call is timed, recorded as decode_ns. Decoder order is shuffled per (sample, repetition) with a seeded PRNG so neither side gets a systematic warm-up advantage. Dynamsoft uses ReadBarcodes_Default with BF_ALL.
Step 3: Run the Benchmark
The browser walks the manifest and POSTs each per-image record to the Node collector, which scores it against the manifest ground truth and appends it to results.jsonl. The append-only stream keeps long runs resumable: the collector tracks which (sample, decoder, repetition) records already exist, so an interrupted pass picks up where it stopped instead of re-decoding.
Each decoder made one timed pass over all 8,000 images. The test machine ran Windows 11 on an Intel Core i5-13400F with 16 logical processors, Node v24.20.0 driving headless Chrome 156, and one benchmark process at a time.
Step 4: Validate Results
Validation covers the record schema, image and ground truth counts, repetition consistency, summary totals, and explicit decoder errors.
node tools/validate_results.mjs `
--results results/full/results.jsonl `
--summary results/full/summary.json `
--expected-images 8000 `
--expected-ground-truth 11372 `
--expected-repetitions 1
Dynamsoft reported three decode timeouts, recorded explicitly as decoder errors and counted as no-read images in the table below. No image failed the browser’s createImageBitmap stage, so both readers received valid pixels for all 8,000 files.
Step 5: Inspect Accuracy and Decode Time
| Decoder | Exact images | Image accuracy | Symbol recall | Precision | Wrong-read images | No read | Incomplete | Mean | Median | P95 |
|---|---|---|---|---|---|---|---|---|---|---|
| Dynamsoft Barcode Reader 11.6.5000 | 6,496 / 8,000 | 81.20% | 82.39% | 99.25% | 67 | 1,050 | 387 | 118.28 ms | 43.95 ms | 330.70 ms |
| zxing-wasm 3.1.2 | 3,851 / 8,000 | 48.14% | 49.38% | 98.96% | 54 | 3,832 | 263 | 25.63 ms | 19.90 ms | 72.20 ms |
Failures are split into wrong-read images (at least one unmatched prediction), no-read images (expected symbols and zero matches), and incomplete images (some matches, no unmatched predictions). An SDK error counts as no read. Neither reader produced a prediction on any of the 200 background-only controls. The 9,572 symbols read by at least one of the two readers leave 1,326 supported symbols unread by both.
The headline gap is coverage: Dynamsoft matched 3,753 more annotated symbols and produced 2,645 more exact images, a 33.06 percentage point lead in image accuracy, while holding a 0.29 point precision edge. On the 16 symbologies both engines support, recall is 91.10% versus 74.56%. zxing-wasm keeps a much faster median decode time (19.90 ms versus 43.95 ms) and a far shorter tail (P95 72.20 ms versus 330.70 ms). Treat the numbers as a measured trade-off on this corpus, not a universal ranking for every barcode workload.
Scoring normalizes UPC-A to its zero-prefixed EAN-13 equivalent, expands UPC-E, folds CODE_39 extensions and ITF14 into their base formats, strips GS1-128 / CODE_128 ]C1, {GS}, and {FNC1} markers, strips Codabar start/stop characters, and removes postal check characters when they validate. The per-format breakdown shows where the gap comes from:
| Symbology | Annotated symbols | Dynamsoft correct | zxing-wasm correct |
|---|---|---|---|
| CODE_128 | 470 | 433 (92.13%) | 288 (61.28%) |
| GS1_128 | 463 | 435 (93.95%) | 231 (49.89%) |
| EAN_13 | 478 | 467 (97.70%) | 380 (79.50%) |
| QR_CODE | 473 | 458 (96.83%) | 454 (95.98%) |
| PDF_417 | 471 | 420 (89.17%) | 299 (63.48%) |
| UPC_A | 474 | 470 (99.16%) | 382 (80.59%) |
| DATA_MATRIX | 468 | 453 (96.79%) | 458 (97.86%) |
| DOTCODE | 493 | 365 (74.04%) | 0 (0.00%) |
| POSTNET | 467 | 354 (75.80%) | 0 (0.00%) |
| MAXICODE | 470 | 330 (70.21%) | 0 (0.00%) |
Difficulty shows up in the scenario breakdown. Dynamsoft scored 91.22% exact images on clean labels, 73.87% under perspective, 74.31% under partial occlusion, and 65.75% on combined effects. zxing-wasm scored 56.59%, 52.90%, 52.18%, and 31.03% on the same groups. Frames with four annotated symbols were exact on 26.3% of images for Dynamsoft and 15.8% for zxing-wasm.
Dynamsoft, the developer of Dynamsoft Barcode Reader, built and published this benchmark. The corpus generator, manifest hashes, curation rules, decoder settings, raw records, and the generated report all ship with the project so anyone can re-check the comparison.
The generated HTML report lists every no-read and incomplete filename by reader, links to the original JPEG, shows the annotations and returned values, and reports per-symbol recall, precision, format coverage, multi-code results, and false positives on the controls.

python report.py --browser-run results/browser-dbr-zxing --output review/browser
JavaScript vs. C++ and Python: Same Corpus, Different Runtimes
The C++ and Python articles score the identical 8,000-image manifest. This JavaScript project reuses that manifest — same JPEG hashes, same ground truth — so the series isolates how much the language/runtime binding and image path move measured results on unchanged input.
| Decoder | Run | Exact images | Image accuracy | Symbol recall | Precision | Mean decode time |
|---|---|---|---|---|---|---|
| Dynamsoft Barcode Reader | C++ / Linux 11.6.50.29329 | 6,714 / 8,000 | 83.93% | 85.05% | 98.80% | 39.11 ms |
| Dynamsoft Barcode Reader | Python 3.6.5000 | 6,701 / 8,000 | 83.76% | 84.96% | 98.88% | 51.88 ms |
| Dynamsoft Barcode Reader | JavaScript 11.6.5000 | 6,496 / 8,000 | 81.20% | 82.39% | 99.25% | 118.28 ms |
| ZXing-C++ | C++ / Linux 3.1.1 | 3,852 / 8,000 | 48.15% | 49.38% | 98.93% | 8.60 ms |
| ZXing-C++ | Python 3.1.1 | 3,852 / 8,000 | 48.15% | 49.38% | 98.93% | 14.12 ms |
| zxing-wasm | JavaScript 3.1.2 | 3,851 / 8,000 | 48.14% | 49.38% | 98.96% | 25.63 ms |
The open-source ZXing core stays at 48.15% image accuracy across native C++, the Python wheel, and WebAssembly. On the DBR side the two native bindings land within 0.17 points and the browser bundle gives up roughly 2.5 points to its JPEG → ImageBitmap → RGBA canvas image path and three decode timeouts. Decode times are not directly comparable across runtimes because the browser adds canvas and WASM boundary overhead that the native and OpenCV paths do not have.
Migrating from zxing-wasm to Dynamsoft Barcode Reader
The migration is a decode-call swap, not a pipeline rewrite. Both libraries accept the same browser image primitives and return plain payload text, so your result-handling, UI, and storage code carries over.
Before (zxing-wasm):
const results = await ZXingWASM.readBarcodes(imageData);
for (const r of results) {
handle(r.format, r.text);
}
After (Dynamsoft Barcode Reader):
await Dynamsoft.License.LicenseManager.initLicense(licenseKey, true);
await Dynamsoft.Core.CoreModule.loadWasm(["DBR"]);
const cvRouter = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
const captured = await cvRouter.capture(imageData, Dynamsoft.CVR.EnumPresetTemplate.PT_READ_BARCODES);
for (const item of captured.getItems()) {
handle(item.formatString, item.text);
}
Three practical notes:
- Format names map almost one-to-one. zxing-wasm returns
EAN13,QRCode,Code128,DataMatrix; Dynamsoft returnsEAN_13,QR_CODE,CODE_128,DATA_MATRIX. Normalize to a canonical form (uppercase, strip separators) before comparing, exactly as this benchmark’s scorer does. - Payload text is directly comparable. UPC-A may surface as its zero-prefixed EAN-13 equivalent on either side, so apply the same leading-zero normalization your application already needs.
- Initialization is a one-time await. Load the WASM module and create the router once at startup, then reuse the router for every frame or image — the per-call cost after that is just the decode.
Accuracy Metrics
Image accuracy measures whole images where every expected symbol matched and no extra prediction appeared; symbol recall measures how completely a reader covers the barcodes that actually exist; precision measures how trustworthy its answers are when it does report one:
Image accuracy = exact images / 8,000 images
Symbol recall = matched ground truth symbols / 11,372 annotated symbols
Precision = matched symbols / (matched symbols + unmatched predictions)
A no-read or incomplete image means at least one expected symbol went unread, so it pulls recall down without touching precision unless an unmatched prediction was also returned. An extra_result, wrong_text, or wrong_format prediction matches no ground truth barcode, so it pulls precision down.
Matching Rules
- Ground truth and predictions are matched one to one as multisets.
- The key is canonical barcode format plus exact normalized payload.
- UPC-A and the equivalent zero-prefixed EAN-13 value are treated as equal; UPC-E is expanded.
- CODE_39 extensions and ITF14 fold into their base formats.
- GS1-128 / CODE_128 leading
]C1,{GS},{FNC1}, and ASCII GS markers are stripped before scoring. - Codabar start/stop characters and validated postal check characters are removed before scoring.
- HTML entities, trailing newlines, and escaping are normalized before scoring.
- ZXing
GS1_128results are recovered from the]C1symbology identifier. - Barcode location is not part of the score; unsupported formats remain visible in coverage-adjusted metrics.
- Decoder errors and input pipeline errors are explicit outcomes.
Common Issues & Edge Cases
- zxing-wasm rejects a canvas element: Version 3.x does not accept a canvas directly. Pass an
ImageData(fromctx.getImageData) or aBlob; this benchmark usesImageDataso both readers share the same pixels. - DBR fails during initialization: Supply a valid license through
LicenseManager.initLicense. Without a key the SDK falls back to a 24-hour public demo license. - A decode call times out: Three Dynamsoft calls hit the SDK timeout in this run. They are recorded as explicit decoder errors and counted as no-read images, not dropped from the denominator.
- A run stops before completion: Reload the page and click Run again. The collector recognizes finished (sample, decoder, repetition) records and resumes past them instead of re-decoding.
When to Choose Dynamsoft Barcode Reader or zxing-wasm
Verdict: For a production web scanner that meets damaged, crowded, or mixed-symbology labels, Dynamsoft Barcode Reader is the safer default — 2,645 more exact images on the same 8,000 files. zxing-wasm is the better choice when the input is controlled, the bundle must stay open source, and a roughly 33-point image-accuracy gap is acceptable.
| Best fit | Poor fit | |
|---|---|---|
| Dynamsoft Barcode Reader 11.6.5000 | Production capture where a missed code costs a transaction; damaged, blurred, or low-contrast labels; frames with several symbols; postal and industrial formats; teams that need templates and support | A prototype where the SDK payload is the largest asset on the page; workloads where a 118 ms mean decode is too slow |
| zxing-wasm 3.1.2 | Controlled images — screens, clean print, fixed lighting; open-source-only distribution; offline tools where a 25 ms mean decode matters more than coverage | Crowded or damaged captures; any pipeline that needs DotCode, POSTNET, MSI, or Pharmacode |
Tested with: Dynamsoft Barcode Reader JavaScript bundle 11.6.5000 and zxing-wasm 3.1.2, headless Chrome 156 on Windows 11, Intel Core i5-13400F, Node v24.20.0. Input: the 8,000-image synthetic manifest, 11,372 annotated symbols. Benchmark date: 2026-11-19.
Effort and licensing: both readers load in the same page, so integration effort is comparable — the difference is the licence. The migration section above is the code that changes.
If your web pipeline cannot afford missed reads, Dynamsoft Barcode Reader is the stronger fit in this benchmark: it returned 3,753 more matched symbols on the corpus, and that margin matters most on damaged labels, crowded scenes, and mixed-symbology captures. It also brings configurable capture templates, packaged runtime assets, and commercial support.
If you want an engine you can inspect, patch, and ship without license fees, zxing-wasm remains a solid option. Its 98.96% precision in this run shows its answers are trustworthy when it finds one, its median decode time is less than half of Dynamsoft’s, and for controlled inputs where lower coverage is acceptable, the open-source stack may be all you need.
Conclusion
This project shows that a JavaScript benchmark can carry the same audit trail as the native and Python builds: the shared manifest, resumable JSONL records, combined JSON package, environment snapshot, and generated HTML report let any reviewer reproduce the accuracy and decode-time numbers above. Paired with the C++ and Python runs on the identical manifest, it also isolates how much the browser/WASM runtime moves those numbers on unchanged input — and it doubles as a working migration reference for teams moving a web scanner from zxing-wasm to Dynamsoft Barcode Reader.
Reproducibility
The manifest, the raw records, and the report are published, so the accuracy and precision above can be recomputed line by line rather than taken on trust.
- Manifest. The same 8,000-image manifest as the C++ and Python companions, matched by SHA-256: 11,372 annotated symbols, 200 background-only controls.
- Raw records.
results/browser-dbr-zxing/results.jsonlholds one record per image per decoder, plusrun.jsonandenvironment.jsonwith the pinned browser and decoder versions. - Environment. The report pins headless Chrome 156, Node v24.20.0, the WASM bundles, and the decoder versions.
- Source. Complete benchmark project on GitHub.
Because the manifest is byte-identical to the native runs, a difference between this page and the C++ or Python page is a runtime difference on unchanged pixels — which is exactly what the comparison table above measures.
Want to run this code in your own project?
Get a 30-day free trial license