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

moonbitlang / core / 6230
91%

Build:
DEFAULT BRANCH: main
Ran 20 Aug 2026 08:06AM UTC
Jobs 1
Files 445
Run time 2min
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

20 Aug 2026 08:02AM UTC coverage: 90.734%. Remained the same
6230

push

github

bobzhang
perf(builtin): count rev_foldi's index up instead of deriving it per iteration

Completes PR #3784 (mizchi) on current main, where three of its four
FixedArray reverse-iteration optimizations have already landed. The
remaining delta is rev_foldi, which computed the ascending index as
len - i - 1 on every iteration inside the descending range loop.

Instead of that PR's C-style three-variable loop, the index becomes a
second loop state of the same readable range form:

  for i in self.length()>..0; index = 0, acc = init {
    continue index + 1, f(index, acc, self.unsafe_get(i))
  }

Measured identical to the C-style loop (11.19 vs 11.20 us native) and
faster than main on all three backends (rev_foldi, n=100K, sum fold):
native 14.88 -> 11.19us (1.33x), js 72.4 -> 59.9us (1.21x), wasm-gc
75.5 -> 65.6us (1.15x). Per-element times (~0.1ns) show the fold is
fully inlined and auto-vectorized in this benchmark; the win is the
per-lane subtract dependency of len - i - 1 vectorizing worse than a
counting index. With an opaque, non-inlinable closure the difference
shrinks accordingly.

Also adopts #3784's test pinning the reversed index/element pairing,
which a miscounted index would break.

Codex CLI review (xhigh, first-round sign-off): (index, element)
pairing verified as (0,len-1)..(len-1,0) against the documented
reverse-range and simultaneous-update semantics (f receives the
pre-increment index); the pairing-test trace recomputed to 30120210;
raise-polymorphism and the nobreak return intact; benchmark ratios
recomputed (1.33x/1.21x/1.15x) and microbenchmark-scoped.

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

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

16304 of 17969 relevant lines covered (90.73%)

332567.99 hits per line

Jobs
ID Job ID Ran Files Coverage
1 6230.1 20 Aug 2026 08:06AM UTC 446
90.75
GitHub Action Run
Source Files on build 6230
  • Tree
  • List 445
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 3b2e6cbd on github
  • Prev Build on main (#6226)
  • Next Build on main (#6233)
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