Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 9, 2026

Diffs

Description

Replaces element-wise loops with bulk memory operations in three bitset functions for better performance and code clarity.

Changes

  • AssignLong: memmove() instead of loop (handles potential overlap)
  • MakeCopyLong: memcpy() instead of loop (destination is freshly allocated)
  • MakeEmptyArrayBits: memset() instead of zero-initialization loop
// Before
for (unsigned i = 0; i < len; i++)
{
    lhs[i] = rhs[i];
}

// After
memmove(lhs, rhs, len * sizeof(size_t));

All functions operate on size_t* arrays where len = BitSetTraits::GetArrSize(env). Standard library functions are available via jitpch.h.

Original prompt

File a PR against dotnet/runtime and replace plain loops in bitsetasshortlong.h with memset/memmove calls where profitable. Namely, MakeCopyLong and AssignLong


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Feb 9, 2026
Copilot AI changed the title [WIP] Replace loops with memset/memmove in bitsetasshortlong.h Replace loops with memcpy/memmove/memset in bitsetasshortlong.h Feb 9, 2026
Copilot AI requested a review from EgorBo February 9, 2026 12:59
@EgorBo
Copy link
Member

EgorBo commented Feb 9, 2026

Some visible improvements in TP, but it's possible because of the retired-instruction metric + we don't use Native PGO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants