r/Protos • • 5h ago

Optimizing a JSON parser without changing its public API

How much unnecessary work happens between reading a JSON document and constructing its final object tree?

The latest Protos JSON parser update targets three areas:

  • Temporary allocations during token scanning.
  • Redundant byte reads and unnecessary decoding.
  • Repeated array copying during tree construction.

Arrays now accumulate elements in fixed-size blocks before linear final materialization.

Exact numeric representation, Unicode handling, dynamic constructor selection and reentrant parsing retain their existing contracts.

The implementation remains entirely in Protos, with no production Java changes. All 20 exhaustive CI jobs passed.

Website: https://protoslang.com

Source: https://github.com/guillermomolina/protos

Which tends to dominate JSON parsing costs in your workloads: scanning, allocation or tree construction?

1 Upvotes

0 comments sorted by