Skip to content

feat(demo): browser benchmark page comparing proj-wasm and proj4js - #11

Merged
kochizufan merged 3 commits into
train/2026-12from
dec26/m1-t6-benchmark-demo
Oct 27, 2026
Merged

kochizufan merged 3 commits into
train/2026-12from
dec26/m1-t6-benchmark-demo

Conversation

@kochizufan

Copy link
Copy Markdown
Member

Summary

Adds the second demo page, a browser benchmark that compares proj-wasm and proj4js on the same input.

  • demo/benchmark.html (+ portal card): the same point sequence and the same CRS rows go forward and back through both engines. The page shows the input (category, point limit, work count, CRS scope) and the output: elapsed time, success / failure counts, mean and max round-trip error in metres, the largest difference between the two engines' forward output, and the message behind each failure.
  • CRS scope: EPSG:3857, JGD2000 and Tokyo plane rectangular I–XIX, JGD2000 UTM 51–55, historical city-plan grids (UTJCP A/B/C). Select all, one group or one CRS. Rows come from the Atlas search around the whole bundled dataset, so they do not depend on the points of the run. An id that cannot be found stays in the table as "not found" (today only plane rectangular XVII, the Daito Islands, has no dataset point inside it).
  • One-click contrast engine-coverage: A = plane rectangular IX (both engines succeed on every point; forward difference about 1e-9 m), B = historical grid zone B (proj-wasm succeeds; proj4js fails on every point with Could not get projection name from: +proj=pipeline …).
  • Data: summits from the GSI list of 1003 major mountains (2026-03-31 edition) and the four extreme points of Japan. Source, licence (GSI content terms, PDL1.0, CC BY 4.0 compatible), retrieval date and processing steps are in demo/data/benchmark-places.provenance.json and on the page.
  • proj4 2.22.0 is added as an exact devDependency. It is not in dependencies, and demo/ is not in the published files.
  • verify:demo now checks the benchmark page, its two data assets under /Atlas/ and the second portal card.
  • openspec atlas-benchmark-demo/tasks.md: all items checked, with implementation notes.

Follow-ups to the candidate CRS demo:

  • a test that each demo page imports and calls its init function
  • a test that a manual change after a preset returns the page to neutral
  • the area-name mapping now lives only in demo/presets.js
  • jsdom ^30.0.1

Test plan

  • pnpm run test (25 files, 151 tests), typecheck, build, verify:demo, verify:packed-browser: all exit 0; git status --short dist is empty
  • pnpm pack --dry-run lists no demo/ and no proj4; pnpm audit --prod reports no vulnerabilities
  • Opened the Pages build served under /Atlas/ in Chrome: both cards on the portal, the page initializes, preset A and B split as described, "all CRS" runs

🤖 Generated with Claude Code

kochizufan and others added 3 commits October 28, 2026 03:12
- demo/benchmark.html with its own portal card: the same point sequence and the same
  CRS rows go forward and back through proj-wasm (single-threaded browser runtime) and
  proj4js. The page shows elapsed time, success and failure counts, round-trip error in
  metres, the largest difference between the two engines' forward output, and the
  message behind every failure. Work larger than the point set cycles back to the start.
- CRS scope: EPSG:3857, JGD2000 and Tokyo plane rectangular I-XIX, JGD2000 UTM 51-55
  and the historical city-plan grids, selectable as all, one group or one CRS. Rows are
  found through the Atlas search around the whole bundled dataset, so they do not depend
  on the points of the run; an id that cannot be found stays in the table as not found.
- A one-click contrast (engine-coverage): plane rectangular IX, where both engines
  succeed, against historical grid zone B, which only proj-wasm can read.
- Bundled data: summits from the GSI list of 1003 major mountains and the four extreme
  points of Japan, with source, licence (PDL1.0) and processing notes.
- proj4 2.22.0 as an exact devDependency; it is not a runtime dependency and the demo is
  not in the published files.
- Pages build verification covers the new page, its data and the second portal card.
- Candidate CRS demo: a test that the page calls initDemo(), a test for going back to
  neutral after a manual change, one area-name mapping instead of two, jsdom ^30.0.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… operation

- runProjWasmEngine returned the bare stats when the operation could not be created,
  so runBenchmark stopped with a TypeError and the page showed nothing. It now returns
  { stats, forward } like every other branch; the row is marked failed with the message.
- Stub-engine tests pin the numbers the page shows: the forward difference between the
  two engines, the round-trip error in metres, and per-point proj4js failures.
- The real-engine test now requires a forward difference above zero (the engines
  compute separately) and below 1e-6 m.
- A data test checks that every bundled place lies in Japan, has a name and a known
  category; the provenance note now says so instead of claiming a load-time check.
- Test comments: the sample summits are in Yamanashi and Shizuoka; drop a dangling note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kochizufan
kochizufan marked this pull request as ready for review October 27, 2026 18:57
@kochizufan
kochizufan merged commit c771b6f into train/2026-12 Oct 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant