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

Improve performance of BAM sequence encoding #35

Merged
merged 2 commits into from
Apr 3, 2017

Conversation

alumi
Copy link
Member

@alumi alumi commented Apr 3, 2017

Refactored bam encoding to use static table.

This PR improves performance of sequence encoding about 20x faster.

Old codes and tests are removed.

Copy link
Member

@totakke totakke left a comment

Choose a reason for hiding this comment

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

Great improvement. I've commented on points I felt strange. I'm waiting for reply or fix.

(->> (for [i nibble-table j nibble-table] [i j])
(apply concat)
cstr/join)))
(defonce ^:private ^:const base->nibble "=ACMGRSVTWYHKDBN")
Copy link
Member

Choose a reason for hiding this comment

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

base->nibble is not appropriate name. foo->bar should be used for a converter function.

Why using defonce? defonce has a merit when reloading a namespace. In this case, it seems to have no merit. Also two-bytes->byte-table and seq-byte-table.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for the comment.
Fixed the names for static tables with comments to be more descriptive.

As sizes of these static tables are not so trivial (<17KB), I used defonce to mark that they shouldn't be reallocated / recalculated.
There're no advantages in runtime in the usual case, as you mentioned. I fixed them to def.

@totakke totakke merged commit 7331e39 into master Apr 3, 2017
totakke added a commit that referenced this pull request Apr 3, 2017
@totakke
Copy link
Member

totakke commented Apr 3, 2017

Thank you!

@totakke totakke deleted the feature/bam-seq-encode branch April 3, 2017 09:00
@totakke totakke changed the title Feature/bam seq encode Improve performance of BAM sequence encoding Apr 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants