Benjamin-Lee / Benjamin-Lee/CodonAdaptationIndex

Small performance improvement

Open
#9 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
38
Forks
11
PR merge metrics
No merged PRs in 30d

Description

I am checking RSCU() method and it seems to me that small performance improvement is possible in codon counting. It should be faster to once call upper() method for a sequence than for each of it's codons separately.
Lines ~80, adding line like `sequences = [s.upper() for s in sequences]` can improve perf.

Simple check shows ~30% improvements:
> python3 -m timeit 'x = ("a"*300000); [x[i: i+3].upper() for i in range(0, len(x), 3)]'
> 10 loops, best of 3: 21.3 msec per loop
> python3 -m timeit 'x = ("a"*300000).upper(); [x[i: i+3] for i in range(0, len(x), 3)]'
> 100 loops, best of 3: 14.5 msec per loop

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.