Skip to content

Remove redundant copy in getSequenceInRange#1385

Closed
nh13 wants to merge 1 commit into
pysam-developers:masterfrom
nh13:nh13/fix-sequence-range-copy
Closed

Remove redundant copy in getSequenceInRange#1385
nh13 wants to merge 1 commit into
pysam-developers:masterfrom
nh13:nh13/fix-sequence-range-copy

Conversation

@nh13
Copy link
Copy Markdown
Contributor

@nh13 nh13 commented Mar 2, 2026

Summary

  • Remove a redundant copy in getSequenceInRange where charptr_to_bytes(seq) was called on seq which is already a Python bytes object created by PyBytes_FromStringAndSize
  • The charptr_to_bytes call was converting bytes → const char* → bytes, creating an unnecessary copy

Test plan

  • Run REF_PATH=: pytest tests/AlignedSegment_test.py -v

AI disclosure: This PR was AI-assisted using Claude Code. The issue was identified via AI-guided code review, and the implementation was drafted by AI with human review and approval.

@nh13 nh13 marked this pull request as draft March 3, 2026 06:21
@nh13 nh13 changed the title perf: remove redundant copy in getSequenceInRange Remove redundant copy in getSequenceInRange Mar 3, 2026
@jmarshall
Copy link
Copy Markdown
Member

Thanks. Removing this silly mistake does make an observable difference to the speed.

However we can do better — now also superseded by PR #1411.

@jmarshall jmarshall closed this May 28, 2026
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.

2 participants