Skip to content

Document tobytes() copy behavior in NumPy array hashing#343

Merged
shaypal5 merged 2 commits into
codex/add-test-and-benchmark-for-numpy-array-performancefrom
copilot/sub-pr-337-again
Feb 18, 2026
Merged

Document tobytes() copy behavior in NumPy array hashing#343
shaypal5 merged 2 commits into
codex/add-test-and-benchmark-for-numpy-array-performancefrom
copilot/sub-pr-337-again

Conversation

Copilot AI commented Feb 18, 2026

Copy link
Copy Markdown
Contributor

The _hash_numpy_array function uses tobytes(order="C") to ensure consistent hashing regardless of memory layout, but this can incur a copy for non-contiguous arrays.

Changes

  • Enhanced docstring for _hash_numpy_array: Documents that tobytes(order="C") may copy data for non-contiguous arrays (transposed, sliced views, Fortran-ordered) with performance implications for large arrays. Includes best practices in Notes section.

The behavior is correct and intentional—C-order normalization ensures deterministic hashes—but now explicitly documented for users working with large non-contiguous arrays.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Update NumPy-aware hashing based on feedback Document tobytes() copy behavior in NumPy array hashing Feb 18, 2026
Copilot AI requested a review from shaypal5 February 18, 2026 17:21
@shaypal5 shaypal5 marked this pull request as ready for review February 18, 2026 17:29
@shaypal5 shaypal5 merged commit c33c6be into codex/add-test-and-benchmark-for-numpy-array-performance Feb 18, 2026
1 check passed
@shaypal5 shaypal5 deleted the copilot/sub-pr-337-again branch February 18, 2026 17:29
shaypal5 added a commit that referenced this pull request Mar 20, 2026
* Initial plan

* Document tobytes(order="C") behavior in _hash_numpy_array docstring

Co-authored-by: shaypal5 <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: shaypal5 <[email protected]>
@shaypal5 shaypal5 added AI & Agents area: agent-workflows Agent instructions, AI-assisted workflow docs, or bot-maintained guidance. area: config Global/default configuration and settings. area: hashing Hashing, key generation, argument handling, or signatures. enhancement impact: performance Performance, scalability, or benchmark impact. outcome: merged Merged into the repository. source: copilot Opened by GitHub Copilot coding agent. type: feature Adds or materially changes user-facing functionality. type: perf Performance optimization or benchmark-driven change. type: tests Tests, fixtures, test coverage, or test data. and removed enhancement AI & Agents type: feature Adds or materially changes user-facing functionality. type: tests Tests, fixtures, test coverage, or test data. type: perf Performance optimization or benchmark-driven change. area: agent-workflows Agent instructions, AI-assisted workflow docs, or bot-maintained guidance. labels Jun 13, 2026
@shaypal5 shaypal5 added type: chore Maintenance work that is not otherwise categorized. size: small Small PR by changed-file count. and removed impact: performance Performance, scalability, or benchmark impact. labels Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: config Global/default configuration and settings. area: hashing Hashing, key generation, argument handling, or signatures. outcome: merged Merged into the repository. size: small Small PR by changed-file count. source: copilot Opened by GitHub Copilot coding agent. type: chore Maintenance work that is not otherwise categorized.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants