• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moonbitlang / core / 4522 / 1
94%
main: 94%

Build:
DEFAULT BRANCH: main
Ran 29 May 2026 03:33AM UTC
Files 371
Run time 9s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

29 May 2026 03:32AM UTC coverage: 93.999% (+0.001%) from 93.998%
4522.1

push

github

bobzhang
perf(json): scan whitespace directly to avoid per-call StringView alloc

`ParseContext::lex_skip_whitespace` is called at the start of every
`lex_value` / `lex_after_*` step. The original implementation built
a `StringView` of the remaining input on every call and ran
`lexmatch [ \t\r\n]+` on it. That StringView wrapper showed up as the
#1 allocation source in JSON parsing workloads.

Since JSON whitespace is ASCII-only, we can scan UTF-16 code units
directly on the existing input view with identical semantics and zero
allocations. `offset` is held in a local for the duration of the scan
so each consumed whitespace character is one `local.set` instead of a
`struct.set` against `ctx`.

Measured on a 197 KB JSON-array-of-1000-objects parsed 50 times
(wasm-gc, wasmtime):

  Total alloc bytes : 145.13 MB ->  107.37 MB   (-26.0 %)
  Total #allocs     :  13.15 M  ->    9.85 M    (-25.1 %)
  StringView::view  :  32.62 MB ->    7.44 MB   (-77.2 %)
  String::view      :  12.59 MB ->   0          (gone)

Adds a focused `test "lex_skip_whitespace"` covering the empty-input,
all-whitespace, leading-whitespace, no-leading-whitespace, and
non-ASCII (U+00A0 NBSP must NOT count as JSON whitespace per
RFC 8259) cases.

Reproduction: github.com/mizchi/pprof-mbt (moon-pprof memprofile +
summary --diff).

Tests: moon test passes (6507 / 6507).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

14944 of 15898 relevant lines covered (94.0%)

206730.3 hits per line

Source Files on job 4522.1
  • Tree
  • List 371
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 4522
  • 4eb3ae29 on github
  • Prev Job for on main (#4518.1)
  • Next Job for on main (#4526.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc