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

moonbitlang / core / 6852
89%

Build:
DEFAULT BRANCH: main
Ran 27 Sep 2026 07:33AM UTC
Jobs 1
Files 450
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

27 Sep 2026 07:30AM UTC coverage: 89.503% (-0.1%) from 89.607%
6852

push

github

bobzhang
perf(builtin): SIMD-accelerate String::to_upper and StringView::to_upper

`to_upper` still searched with `find_by(closure)` and rebuilt the result
char by char through a `StringBuilder` on every backend, while `to_lower`
already had an allocation-free SIMD search and an exact-size copy patched
in place.

Bring `to_upper` to parity by generalising the `to_lower` helpers:

- `find_ascii_uppercase_code_unit_simd` becomes
  `find_ascii_range_code_unit_simd(data, start, len, first, last)`; the
  new `find_ascii_lowercase_code_unit` dispatcher mirrors the uppercase
  one (literal scalar loop below 24 units, else the range search).
- `ascii_lowercase_copy` becomes `ascii_case_copy(view, first_match,
  first, last, delta)`: exact-size copy, then an i16x8 patch on native
  and wasm (lane add wraps, so delta -32 subtracts 0x20) and a scalar
  in-place patch on wasm-gc.
- js keeps its `find_by` + `StringBuilder` path, now selected with
  `#cfg(target="js")` exactly like `to_lower`.

moonc never inlines functions containing loops, so the range bounds are
runtime arguments of the outlined search and copy. They only feed the
splats before the vector loop and the scalar checks; the dispatchers keep
literal short-path loops, so `to_lower`'s call structure is unchanged.
The vector-loop guards are written as `end - pos >= 8` so they cannot
overflow.

Tests: to_upper boundary tests mirroring to_lower's; a QuickCheck
differential of to_upper and to_lower against a code-unit model over
strings of 40+ units with range edges, their neighbours, non-ASCII units
with ASCII-letter low bytes and surrogates, on strings and padded views;
exhaustive position/offset sweeps; and a native/wasm whitebox test that
calls the SIMD search directly. Adds string_to_upper_bench_test.mbt
mirroring the to_lower benchmarks.

Signed-off-by: Codex CLI <codex@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

32 of 38 new or added lines in 1 file covered. (84.21%)

20 existing lines in 1 file now uncovered.

16550 of 18491 relevant lines covered (89.5%)

316721.05 hits per line

Uncovered Changes

Lines Coverage ∆ File
6
87.03
-3.65% builtin/string_methods.mbt

Coverage Regressions

Lines Coverage ∆ File
20
87.03
-3.65% builtin/string_methods.mbt
Jobs
ID Job ID Ran Files Coverage
1 6852.1 27 Sep 2026 07:33AM UTC 450
89.5
GitHub Action Run
Source Files on build 6852
  • Tree
  • List 450
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 41cb9787 on github
  • Prev Build on main (#6850)
  • Next Build on main (#6854)
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