Skip to content

Use blit for contiguous copies#3560

Merged
bobzhang merged 1 commit into
mainfrom
codex/array-sort-blit
May 8, 2026
Merged

Use blit for contiguous copies#3560
bobzhang merged 1 commit into
mainfrom
codex/array-sort-blit

Conversation

@Yu-zh
Copy link
Copy Markdown
Collaborator

@Yu-zh Yu-zh commented May 8, 2026

Summary

  • use blit for contiguous copies in stable sort merge, bytes conversions/concat, deque linearization paths, and hash set copy
  • add a small internal deque helper for copying the two physical views into a linear buffer
  • avoid initialize-then-overwrite loops in the updated paths

Validation

  • moon check builtin deque hashset --target all --target-dir /tmp/core-blit-pr-check
  • moon test builtin deque hashset --target all --target-dir /tmp/core-blit-pr-test
  • moon fmt
  • moon info
  • git diff --check

No .mbti files changed.

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented May 8, 2026

Coverage Report for CI Build 4263

Coverage increased (+0.004%) to 94.641%

Details

  • Coverage increased (+0.004%) from the base build.
  • Patch coverage: 28 of 28 lines across 4 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 15732
Covered Lines: 14889
Line Coverage: 94.64%
Coverage Strength: 218128.19 hits per line

💛 - Coveralls

@Yu-zh Yu-zh marked this pull request as draft May 8, 2026 14:08
@tonyfettes tonyfettes force-pushed the codex/array-sort-blit branch from ea4953b to 229af7d Compare May 8, 2026 14:12
@Yu-zh Yu-zh marked this pull request as ready for review May 8, 2026 14:14
@bobzhang bobzhang requested a review from Copilot May 8, 2026 16:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request replaces several element-by-element copy loops with blit-based contiguous copies across core collection/bytes utilities to reduce overhead and avoid initialize-then-overwrite patterns, including in the stable-sort merge path.

Changes:

  • HashSet: copy entries via FixedArray::blit_to instead of a manual loop.
  • Deque: introduce a small internal unsafe_blit_to helper and use it in concat (+), copy, and realloc linearization paths.
  • Bytes + stable sort: use make_uninit + UninitializedArray::unsafe_blit(_fixed) and bytes blit helpers for conversions/concat and TimSort merge buffering.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
hashset/hashset.mbt Uses blit_to to copy the backing entries array when cloning a HashSet.
deque/deque.mbt Adds an internal linearization blit helper and uses it for concat/copy/realloc copies.
builtin/bytes.mbt Switches bytes-to-array conversions and bytes concatenation to blit-based copies.
builtin/array_sort_impl.mbt Replaces merge-buffer construction/copy-back loops with UninitializedArray blit operations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bobzhang bobzhang merged commit f9f9d41 into main May 8, 2026
18 checks passed
@bobzhang bobzhang deleted the codex/array-sort-blit branch May 8, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants