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

Simplify expected errors function #796

Merged
merged 1 commit into from
Sep 13, 2024
Merged

Conversation

rhpvorderman
Copy link
Collaborator

The generic unrolled implementation performs similar to the SSE2 tuned code. This should make it faster on ARM platforms as well. In addition it is much easier to read.

# no filter (for reference)
Benchmark 1: cutadapt -o /dev/null  ~/test/5millionreads_R1.fastq
  Time (mean ± σ):      4.958 s ±  0.135 s    [User: 4.554 s, System: 0.399 s]
  Range (min … max):    4.786 s …  5.204 s    10 runs

# Before
Benchmark 1: cutadapt -o /dev/null --max-aer 0.01 ~/test/5millionreads_R1.fastq
  Time (mean ± σ):      6.608 s ±  0.092 s    [User: 6.192 s, System: 0.410 s]
  Range (min … max):    6.490 s …  6.800 s    10 runs

# After
Benchmark 1: cutadapt -o /dev/null --max-aer 0.01 ~/test/5millionreads_R1.fastq
  Time (mean ± σ):      6.612 s ±  0.132 s    [User: 6.197 s, System: 0.409 s]
  Range (min … max):    6.357 s …  6.881 s    10 runs 

Just some light hearted code simplifcation to make my day slightly more interesting (currently meddling with galaxy deployment and I ran cutadapt as a test, which reminded me of this code).

@rhpvorderman
Copy link
Collaborator Author

For reference, here is the performance for just the scalar loop:

Benchmark 1: cutadapt -o /dev/null --max-aer 0.01 ~/test/5millionreads_R1.fastq
  Time (mean ± σ):      7.113 s ±  0.157 s    [User: 6.690 s, System: 0.418 s]
  Range (min … max):    6.869 s …  7.434 s    10 runs

So the unrolling really helps.

@marcelm
Copy link
Owner

marcelm commented Sep 13, 2024

Indeed a nice improvement in readability! Awesome that it’s possible to trust the compiler here.

@marcelm marcelm merged commit 06439f1 into marcelm:main Sep 13, 2024
16 checks passed
@rhpvorderman
Copy link
Collaborator Author

Another advantage is that the computation should generate the same result regardless of architecture, which is not guaranteed if specific intrinsics are used.
I learned this from feedback at a PR at htslib. Great folks all around!

@rhpvorderman rhpvorderman deleted the simpleraverage branch September 13, 2024 09:57
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