Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid allocations when handling reverse-complement sequence data #197

Merged
merged 4 commits into from
Dec 8, 2024

Conversation

sampsyo
Copy link
Collaborator

@sampsyo sampsyo commented Dec 8, 2024

As a follow-up to @AndreaGuarracino's #196, this tries to avoid allocating any buffers for reverse-complements until the last possible second (before printing). Seems to come with a minor but not enormous performance benefit, just for printing.

The idea is to introduce a structure that wraps the underlying &[u8] buffer and a flag for reversals. Then, the only actually do the reverse-complement-ing when we Display. Index trickery makes it possible to treat this new type mostly as if it were an eagerly-computed string.

@sampsyo sampsyo merged commit 47b67b9 into main Dec 8, 2024
12 checks passed
@sampsyo sampsyo deleted the revcomp-noalloc branch December 8, 2024 22:41
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.

1 participant