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

moonbitlang / core / 6502
89%

Build:
DEFAULT BRANCH: main
Ran 02 Sep 2026 09:30AM UTC
Jobs 1
Files 453
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

02 Sep 2026 09:27AM UTC coverage: 90.975% (-0.001%) from 90.976%
6502

push

github

bobzhang
perf: build Array::copy and the to_array paths without a redundant fill

`Array::make(len, elem)` is `Array::unsafe_make_uninit(len)` followed by
`len` `unsafe_set` calls; for a reference element type each of those also
increfs `elem` and decrefs the slot's previous contents. Where the array
is immediately overwritten, all of that is dead.

- Array::copy wrote every element twice: `Array::make(len, self[0])` to
  fill, then `unsafe_blit` over the whole range. The js backend already
  avoided this via `slice(0)`.
- Deque::to_array, SortedSet::to_array and HashMap::to_array reserved
  capacity and pushed. Allocate at final length and write with
  `unsafe_set`, replacing an out-of-line call per element with an inlined
  store. This also removes the seed-value plumbing: HashMap::to_array
  loses the while/break/nobreak block whose only job was finding a value
  to seed `Array::make`, and SortedSet::to_array loses `padding` and
  `unwrap`.

The value is bound to a local before each `unsafe_set`. Written inline as
`xs.unsafe_set(i, self[i])`, the call sits between the buffer load and the
store, and the reference-counting pass brackets the buffer borrow inside
the loop, emitting an incref/decref pair per element that costs more than
the bounds check it saves.

Measured on native/release with the benchmarks from the first commit.
Every A/B varies one file only, with all others pinned, rebuilding each
round.

Array::copy, 4 rounds, ranges disjoint. FixedArray::copy is a control:
its code is identical in both arms.

  Array::copy Int n=1000000      104.7/111.5/111.1/112.9 -> 53.8/55.6/51.6/53.5 us  -50.7%  4/4
  Array::copy Ref n=1000000      2240/2200/2260/2250 -> 1620/1700/1640/1780 us      -26.4%  4/4
  FixedArray::copy Ref (control) 1110/1060/1110/1080 -> 1060/1110/1080/1120 us        0.0%  2/4

to_array, 3 rounds, builtin identical in both arms. Min of rounds:

  Deque::to_array Int      35.2 -> 27.5 us   -21.9%  3/3
  Deque::to_array Ref      99.9 -> 91.7... (continued)

21 of 21 new or added lines in 4 files covered. (100.0%)

16864 of 18537 relevant lines covered (90.97%)

283795.61 hits per line

Jobs
ID Job ID Ran Files Coverage
1 6502.1 02 Sep 2026 09:30AM UTC 454
90.99
GitHub Action Run
Source Files on build 6502
  • Tree
  • List 453
  • Changed 8
  • Source Changed 8
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 8075bd22 on github
  • Prev Build on main (#6499)
  • Next Build on main (#6509)
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