TeXitoi / benchmarksgame-rs

The Computer Language Benchmarks Game: Rust implementations
Other
70 stars 19 forks source link

reverse_complement: Do line wrapping and reverse complement in one step #55

Closed mbrubeck closed 7 years ago

mbrubeck commented 7 years ago

This combines newline handling and the main "reverse complement" step into a single loop. The downside of this is that it can no longer treat the input as u16 in order to transform two bytes with one table lookup. The advantages are faster speed from making a single pass over the data, and no more unsafe code!

This runs about 18% faster than the master branch on my computer.

mbrubeck commented 7 years ago

Pushed some minor stylistic fixes.

mbrubeck commented 7 years ago

As an extra bonus, the sequence of operations in this version more closely resembles the C program, for anyone who wants to do side-by-side comparisons of the two.

cristicbz commented 7 years ago

This is brilliant, I'd love to see it merged!

TeXitoi commented 7 years ago

I can't find a better explaination that what is already done. As Isaac closed the previous submission, do you prefer I submit or you submit?

And maybe we should wait some days on a bench without update before submitting it. That's too much update of the same bench for Isaac ;-)

mbrubeck commented 7 years ago

As Isaac closed the previous submission, do you prefer I submit or you submit?

I'll create a new submission for this after it's stabilized for at least a couple of days.

mbrubeck commented 7 years ago

I haven't come up with any new improvements and am no longer actively working on this benchmark, so I'll submit it later today if there are no other comments or changes posted.

TeXitoi commented 7 years ago

OK for me, I'll merge when you provide the link to the submission.

mbrubeck commented 7 years ago

Pushed my final version, which contains comment edits and a few minor style changes since the previous push.

mbrubeck commented 7 years ago

https://alioth.debian.org/tracker/index.php?func=detail&aid=315641&group_id=100815&atid=413122