Skip to content

cppjs-community/package-simdjson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simdjson-cppjs

simdjson compiled to WebAssembly via cpp.js, shipped as a workspace package, and demonstrated in a Vue 3 + Vite app.

Live benchmark

A browser benchmark that compares simdjson-wasm against the built-in JSON.parse on JSON of varying sizes, all running in your browser.

The benchmark page (live at the configured custom domain in packages/simdjson-example-vue/public/CNAME) does the following:

  1. Generates JSON client-side from a seeded PRNG (deterministic across runs).
  2. Runs each parser through warmup + measured iterations.
  3. Reports median, p95, throughput (MB/s), and speedup vs the JSON.parse baseline.
  4. Discloses the methodology (worker-boundary copies, std::string overhead, etc.) so the numbers are honest.

Parsers compared:

  • JSON.parse on the main thread (baseline)
  • JSON.parse in a Web Worker (apples-to-apples cross-thread cost)
  • simdjson::dom running in WASM (full DOM tape — closest to JSON.parse semantics)
  • simdjson::ondemand running in WASM (lazy iteration — typically the fastest)

Repository layout

packages/
  simdjson-wasm/          # C++ → WASM build (via cpp.js + simdjson v4.3.1)
  simdjson-example-vue/   # Vue 3 + Vite demo + benchmark page

Local development

pnpm install
pnpm --filter simdjson-vue-example dev
# open http://localhost:5173/         → benchmark
# open http://localhost:5173/#/demo   → file-upload demo

Production build

pnpm --filter simdjson-vue-example build
pnpm --filter simdjson-vue-example preview

Deploying to GitHub Pages with a custom domain

  1. Push this repo to GitHub.
  2. Enable Pages in repo settings → set the source to GitHub Actions.
  3. Edit packages/simdjson-example-vue/public/CNAME to your domain (the file currently contains a placeholder).
  4. Configure DNS:
    • Apex domain (example.com): A records to GitHub Pages IPs (185.199.108.153, .109.153, .110.153, .111.153) plus AAAA records (2606:50c0:8000::153 etc.).
    • Subdomain (bench.example.com): CNAME pointing to <user>.github.io.
  5. Push to main. The workflow at .github/workflows/deploy.yml builds and deploys.
  6. Wait 5-60 minutes for HTTPS to provision.

The workflow runs pnpm --filter simdjson-vue-example build and uploads the resulting dist/ to Pages.

Note: The large_test_data.json (1 GB) generated by packages/simdjson-example-vue/generate_json.mjs is .gitignored on purpose — it exceeds GitHub's 100 MB per-file limit. The benchmark page generates its own JSON in the browser; the local-file demo expects you to generate the file locally if you want to test it.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors