Comment on How I Wrote an Ultra-Fast DNA Sequence Alignment Algorithm in JavaScriptparentComments−keithwhor11yNice! Would love to see it implemented - though that popcnt instruction isn't accessible via JavaScript as far as I'm aware. ;)−DannyBee11yAlso note - your while loop isn't 0 cycles, in fact, it's probably worse than the bit-twiddling depending on sparseness.This is because the test and branch always happens, and is essentially guaranteed to be mispredicted a lot.These branch mispredictions are likely to cost a lot more than the n cycles it theoretically saves.
Comments
Nice! Would love to see it implemented - though that popcnt instruction isn't accessible via JavaScript as far as I'm aware. ;)
Also note - your while loop isn't 0 cycles, in fact, it's probably worse than the bit-twiddling depending on sparseness.
This is because the test and branch always happens, and is essentially guaranteed to be mispredicted a lot.
These branch mispredictions are likely to cost a lot more than the n cycles it theoretically saves.