Investigation: downsides of being generic and correct

Peter Alexander peter.alexander.au at gmail.com
Thu May 16 04:10:10 PDT 2013


On Thursday, 16 May 2013 at 10:35:12 UTC, Dicebot wrote:
> One open question remains though - can D/Phobos do better here? 
> Can some changes be done to Phobos functions in question to 
> improve performance or creating bioinformatics-specialized 
> library is only practical solution?

Of course things can be improved. For a start, pattern could be a 
template parameter so that most of the checks are inlined and 
const-folded.

Using count!(c => c=='G' || c=='C')(line) from std.algorithm 
would probably perform better as well.

Simply put, countchars is just the obvious naive implementation 
of the algorithm. It hasn't been tuned at all, and isn't suitable 
for use in a small kernel like this.



More information about the Digitalmars-d mailing list