Pas-Kapli / mptp

mPTP - a tool for single-locus species delimitation
GNU Affero General Public License v3.0
24 stars 5 forks source link

Test GCC 5 compliance #58

Open xflouris opened 8 years ago

xflouris commented 8 years ago

Test mptp with the new GCC 5 compiler that is becoming the new standard.

stamatak commented 8 years ago

and don't forget clang, valgrind, a cyclomatic complexity check, as well as a code duplication assessment ;-)

On 04.12.2015 15:53, Tomas Flouri wrote:

Test |mptp| with the new GCC 5 compiler that is becoming the new standard.

— Reply to this email directly or view it on GitHub https://github.com/Pas-Kapli/mptp/issues/58.

Alexandros (Alexis) Stamatakis

Research Group Leader, Heidelberg Institute for Theoretical Studies Full Professor, Dept. of Informatics, Karlsruhe Institute of Technology Adjunct Professor, Dept. of Ecology and Evolutionary Biology, University of Arizona at Tucson

www.exelixis-lab.org

xflouris commented 8 years ago

GCC 5 working, and no clang warnings with -Weverything :)

Now, just out of interest:

I ran pmccabe on mptp with the following command: pmccabe *.c | sort -nr | head -10

and I get the following:

80      80      231     621     465     bayes.c(621): bayes
29      29      70      117     145     svg.c(117): svg_rtree_plot
22      22      112     89      166     multichain.c(89): multichain
21      57      154     128     288     mptp.c(128): args_init
19      22      91      113     183     fasta.c(113): pll_fasta_getnext
19      19      58      134     124     score.c(134): retrieve_mrca_nodes
18      18      55      174     125     dp.c(174): dp_ptp
16      16      45      119     59      bayes.c(119): hpd
14      14      39      593     94      score.c(593): retrieve_mrca_nodes_paschalia
14      14      30      68      65      score.c(68): identify_alternative_taxa

Although the bayesian code is really simple, the cyclomatic check indeed gives a good hint as to break up the function into subparts (which we already thought about doing with Sarah when there is more time). Interestingly, the average cyclomatic number for mptp (LoC: 6k) is 4.97.

A much larger code-base such as RAxML with 56k LoC gives a the following output for: pmccabe *.c | sort -nr | head -10

281     390     922     5259    1671    axml.c(5259): get_args
139     175     578     8764    1033    axml.c(8764): execFunction
105     109     241     2628    420     axml.c(2628): checkSequences
96      96      242     91      481     parsePartitions.c(91): analyzeIdentifier
92      92      566     3504    976     axml.c(3504): modelExists
74      76      362     6671    543     newviewGenericSpecial.c(6671): newviewGTRGAMMAPROT_GAPPED_SAVE
73      101     301     12885   536     axml.c(12885): main
65      72      236     967     409     parsePartitions.c(967): handleExcludeFile
62      67      201     868     311     optimizeModel.c(868): brakGeneric
59      87      229     2942    678     evaluateGenericSpecial.c(2942): evaluateIterative

with an average cyclomatic number of 10.65.

It would be interesting to have a study on the growth of cyclomatic complexity in scientific software over time. For example by running pmccabe on repository code at given time-points (e.g. monthly) and make conclusions on how changes in a team (phd students graduating, postdocs leaving) affect scientific software. Also interesting would be a comparison of such results with industry where teams do not change that often.

stamatak commented 8 years ago

Hi Tomas,

That's an interesting idea, we should discuss this further.

Alexis

On 16.12.2015 15:30, Tomas Flouri wrote:

GCC 5 working, and no clang warnings with -Weverything :)

Now, just out of interest:

I ran |pmccabe| on |mptp| with the following command: |pmccabe *.c | sort -nr | head -10|

and I get the following:

|80 80 231 621 465 bayes.c(621): bayes 29 29 70 117 145 svg.c(117): svg_rtree_plot 22 22 112 89 166 multichain.c(89): multichain 21 57 154 128 288 mptp.c(128): args_init 19 22 91 113 183 fasta.c(113): pll_fasta_getnext 19 19 58 134 124 score.c(134): retrieve_mrca_nodes 18 18 55 174 125 dp.c(174): dp_ptp 16 16 45 119 59 bayes.c(119): hpd 14 14 39 593 94 score.c(593): retrieve_mrca_nodes_paschalia 14 14 30 68 65 score.c(68): identify_alternative_taxa |

Although the bayesian code is really simple, the cyclomatic check indeed gives a good hint as to break up the function into subparts (which we already thought about doing with Sarah when there is more time). Interestingly, the average cyclomatic number for |mptp| (LoC: 6k) is 4.97.

A much larger code-base such as RAxML with 56k LoC gives a the following output for: |pmccabe *.c | sort -nr | head -10|

|281 390 922 5259 1671 axml.c(5259): get_args 139 175 578 8764 1033 axml.c(8764): execFunction 105 109 241 2628 420 axml.c(2628): checkSequences 96 96 242 91 481 parsePartitions.c(91): analyzeIdentifier 92 92 566 3504 976 axml.c(3504): modelExists 74 76 362 6671 543 newviewGenericSpecial.c(6671): newviewGTRGAMMAPROT_GAPPED_SAVE 73 101 301 12885 536 axml.c(12885): main 65 72 236 967 409 parsePartitions.c(967): handleExcludeFile 62 67 201 868 311 optimizeModel.c(868): brakGeneric 59 87 229 2942 678 evaluateGenericSpecial.c(2942): evaluateIterative |

with an average cyclomatic number of 10.65.

It would be interesting to have a study on the growth of cyclomatic complexity in scientific software over time. For example by running |pmccabe| on repository code at given time-points (e.g. monthly) and make conclusions on how changes in a team (phd students graduating, postdocs leaving) affect scientific software. Also interesting would be a comparison of such results with industry where teams do not change that often.

— Reply to this email directly or view it on GitHub https://github.com/Pas-Kapli/mptp/issues/58#issuecomment-165126234.

Alexandros (Alexis) Stamatakis

Research Group Leader, Heidelberg Institute for Theoretical Studies Full Professor, Dept. of Informatics, Karlsruhe Institute of Technology Adjunct Professor, Dept. of Ecology and Evolutionary Biology, University of Arizona at Tucson

www.exelixis-lab.org