Sheffield-iGEM / syn-zeug

A modern toolbox for synthetic biology
https://sheffield-igem.github.io/syn-zeug/
GNU Affero General Public License v3.0
6 stars 3 forks source link

Optimise the Magic `Seq` Constructor #22

Closed TheLostLambda closed 2 years ago

TheLostLambda commented 2 years ago

Currently, if you have a protein that could be DNA or RNA all the way until the last few elements, you end up re-scanning the whole input several times before parsing as a protein.

I reckon it would be faster to do everything in a single pass, with a stack of possible alphabets being eliminated as the sequence is traversed. The top alphabet surviving on that priority stack would be the assigned type.

Needs benchmarking to ensure I'm not just muddling the code for no gain!

TheLostLambda commented 2 years ago

Optimisation was a heavy focus of #30 and performance is likely as good as it will get for the moment.