Skip to content

🤩 SUPER MEGA UPDATE!!! 🤩 - #362

Closed
kshetline wants to merge 21 commits into
json5:mainfrom
kshetline:super-mega-update
Closed

kshetline wants to merge 21 commits into
json5:mainfrom
kshetline:super-mega-update

Conversation

@kshetline

@kshetline kshetline commented Jun 4, 2025 •

Copy link
Copy Markdown

I thought I'd go all out and see how well updating probably way too much at once goes. 😄

This update would supersede and replace the JSON.parse source text access PR.

This update includes:

  • The additional reviver capability from before.
  • A new test suite using mocha and chai, replacing the old tap testing.
  • Updated rollup.
  • Speed enhancements offer by other contributors (@romgrk and @jlguardi), but not yet accepted.
  • A benchmarking script.
  • An EBNF "railroad" style grammar document.

The benchmarking output show how significant the speed improvements are:

--------- 40 MB sample benchmarks (ranked) ----------
1. JSON      x 11.76 ops/sec ±2.51% (33 runs sampled)
2. JSON5     x  1.07 ops/sec ±1.61% (7 runs sampled)
3. Old JSON5 x  0.49 ops/sec ±5.40% (6 runs sampled)
-----------------------------------------------------

--- 60 MB long string sample benchmarks (ranked) ---
1. JSON      x 8.61 ops/sec ±9.76% (25 runs sampled)
2. JSON5     x 0.81 ops/sec ±1.21% (7 runs sampled)
3. Old JSON5 x 0.26 ops/sec ±4.99% (5 runs sampled)
----------------------------------------------------

------ Flight data sample benchmarks (ranked) ------
1. JSON      x 2.59 ops/sec ±9.90% (11 runs sampled)
2. JSON5     x 0.23 ops/sec ±1.48% (5 runs sampled)
3. Old JSON5 x 0.14 ops/sec ±5.62% (5 runs sampled)
----------------------------------------------------

-- Flight data with reviver benchmarks (ranked) ---
1. JSON      x 0.79 ops/sec ±5.83% (6 runs sampled)
2. JSON5     x 0.19 ops/sec ±1.48% (5 runs sampled)
3. Old JSON5 x 0.13 ops/sec ±2.67% (5 runs sampled)
---------------------------------------------------

@kshetline

Copy link
Copy Markdown
Author

Bump.

@kshetline

Copy link
Copy Markdown
Author

Bump again.

@jordanbtucker

Copy link
Copy Markdown
Member

Thanks for this update! There's a lot to unpack here.

Things to move to their own PRs

  • Let's keep the source text access in its own PR.
  • The speed enhancements are welcome, but they'll need to be rebased against main and in their own PRs.
  • The benchmarking script is a great addition to keep track of improvements and regressions.
  • The railroad diagrams and EBNF grammar would be great additions to the docs.

Things to leave out

Thanks again for all your work. Sorry it took so long to get to it, but we're getting JSON5 back on track now.

@kshetline

Copy link
Copy Markdown
Author

I've main a new PR that has only the speed improvements and the reviver changes... those two things are a bit too intermixed to tear apart very easily. I made some ESLint-related changes too, simple because npm run test wouldn't succeed without those changes.

I'll close this PR and handle the railroad diagrams and EBNF grammar in a separate PR, and drop the test suite and build changes for now.

@kshetline kshetline closed this Oct 27, 2026
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.

2 participants