News for hackers. Stuff that matters.
Re:Ask HN: What are you learning? by uoaei on Monday April 06, 2020 @12:28AM (#22790909)
You could also consider providing bioinformatics routines such as global and local sequence alignment. Under the hood they're very similar algorithms.

https://en.wikipedia.org/wiki/Sequence_alignment

https://en.wikipedia.org/wiki/Needleman%E2%80%93Wunsch_algor...

https://en.wikipedia.org/wiki/Smith%E2%80%93Waterman_algorit...

Re:Ask HN: What are you learning? by c0deb0t on Monday April 06, 2020 @03:18AM (#22791516)
Though I probably won't implement the different weighting schemes, I currently have alignment traceback and searching (allow "free shifts" for the pattern string) features.
Re:Ask HN: What are you learning? by mattclase on Monday April 06, 2020 @12:13PM (#22794938)
Here's another recent SIMD aligner if you're interested:

https://github.com/langmead-lab/vargas

Re:Ask HN: What are you learning? by c0deb0t on Monday April 06, 2020 @12:52PM (#22795325)
I took a look at the code, and read the paper. It seems that they directly calculate the entire 2D DP array, but use SIMD to allow each cell to contain multiple values, one for each query string. My approach uses anti-diagonals instead, but it is fast for one vs one comparisons, instead of handling multiple query strings.

Regardless, my goal was to learn some SIMD and Rust (first time for both), so I did not read many background papers.

Re:Ask HN: What are you learning? by mattclase on Monday April 06, 2020 @04:33PM (#22797525)
One thing to keep in mind is for SIMD memory locality is very important; a diagonal vector with a standard 2D DP grid is gonna lead to a lot of cache misses. Just something else to learn about.
Re:Ask HN: What are you learning? by c0deb0t on Tuesday April 07, 2020 @01:47AM (#22800616)
Since I am storing the entire DP matrix as diagonal vectors that are flattened, I don't think there will be many cache misses. Each diagonal only depends on its previous two diagonals, and each diagonal is stored contiguously in memory.

The problem with handling diagonals is that indexing cells and comparing characters on the diagonal becomes complex. Dealing with this without many branches (less branch mispredictions) is the hard part.