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

moonbitlang / core / 4522
94%

Build:
DEFAULT BRANCH: main
Ran 29 May 2026 03:33AM UTC
Jobs 1
Files 370
Run time 1min
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.988%. Remained the same
4522

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>

4 of 4 new or added lines in 1 file covered. (100.0%)

14915 of 15869 relevant lines covered (93.99%)

207108.09 hits per line

Jobs
ID Job ID Ran Files Coverage
1 4522.1 29 May 2026 03:33AM UTC 371
94.0
GitHub Action Run
Source Files on build 4522
  • Tree
  • List 370
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 4eb3ae29 on github
  • Prev Build on main (#4518)
  • Next Build on main (#4526)
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