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

moonbitlang / core / 8012
87%

Build:
DEFAULT BRANCH: main
Ran 09 Nov 2026 12:03AM UTC
Jobs 1
Files 686
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

09 Nov 2026 12:00AM UTC coverage: 88.431% (+0.009%) from 88.422%
8012

push

github

bobzhang
perf(builtin): scan 16 code units per step in single code-unit find/rev_find

The SIMD scanners behind `find`/`rev_find` with a one-code-unit needle and
`find_code_unit`/`rev_find_code_unit` (native and wasm) tested one 8-lane
vector per iteration and built a bitmask for every block. Test two vectors
per iteration instead, OR them, and check with one `any_true`; the bitmask is
built only on a hit. The fewer-than-eight leftover code units, previously
scanned one at a time, are covered by one load of the eight code units at
the far edge of the window. The lanes it shares with earlier loads are known
not to match, so no mask is needed. Windows shorter than eight code units keep
the scalar loop. The forward loop compares remaining length (`end - pos`)
rather than `pos + 16 <= end`, which could overflow near `Int32` max. js (`indexOf`/`lastIndexOf`) and
wasm-gc (scalar) are unchanged.

Median of 3 alternating rounds, `moon bench --release`, arm64 (new/old time):

                          native   wasm
  find absent n=4096       0.60    0.56
  find absent n=256        0.74    0.74
  find absent n=16         0.89    0.95
  rev_find absent n=4096   0.64    0.57
  rev_find absent n=256    0.79    0.76
  rev_find absent n=16     1.03    0.98
  n<=8 cases              0.86-1.03  0.95-1.06

A 4x-unrolled variant reached 0.40x at n=4096 but cost 3-8% at n=13..23 on
native, even when outlined behind a length check, so it was not taken.

A new test places zero, one or two matches at every pair of offsets of a
40-code-unit string and searches every view of it in both directions,
reaching both halves of the block, the single 8-unit step and the edge load
from every alignment, and pinning which lane wins when two matches share a
vector. Each lane-selection, ordering and edge-check mutation of the new code
fails the builtin suite (14 mutations, 1-10 failing tests each).

Codex CLI review (2 rounds, reran the benchmarks against main itself):
"Approved; no blocking issue... (continued)

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

25270 of 28576 relevant lines covered (88.43%)

422113.06 hits per line

Jobs
ID Job ID Ran Files Coverage
1 8012.1 09 Nov 2026 12:03AM UTC 686
88.43
GitHub Action Run
Source Files on build 8012
  • Tree
  • List 686
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 884369ba on github
  • Prev Build on main (#8010)
  • Next Build on main (#8014)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc