Code improvement for DNA reverse complement?

Laeeth Isharc via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 20 15:42:11 PDT 2017


On Friday, 19 May 2017 at 07:29:44 UTC, biocyberman wrote:
> I am solving this problem http://rosalind.info/problems/revc/ 
> as an exercise to learn D. This is my solution:
>
> https://dpaste.dzfl.pl/8aa667f962b7
>
> Is there some D tricks I can use to make the 
> `reverseComplement` function more concise and speedy? Any other 
> comments for improvement of the whole solution are also much 
> appreciated.

You might try using ldc in release mode.  With dmd, cost of 
ranges and so on might be higher than doing it in a more direct 
low-level way.  With ldc that difference often seems to shrink to 
insignificance as its optimisation is more powerful.  If you care 
about performance then use ldc or gdc.  (I have less experience 
with gdc, but probably similar).  But then it's best to compare 
results under ldc because the ratios of different options will be 
different vs dmd.




More information about the Digitalmars-d-learn mailing list