facebookresearch / fastText
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 392 units with 4,656 lines of code in units (61.7% of code).
    • 0 very complex units (0 lines of code)
    • 2 complex units (195 lines of code)
    • 9 medium complex units (383 lines of code)
    • 34 simple units (976 lines of code)
    • 347 very simple units (3,102 lines of code)
0% | 4% | 8% | 20% | 66%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
cc0% | 3% | 9% | 25% | 61%
py0% | 8% | 0% | 16% | 75%
cpp0% | 0% | 100% | 0% | 0%
js0% | 0% | 0% | 0% | 100%
h0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
src0% | 4% | 8% | 26% | 60%
alignment0% | 22% | 0% | 8% | 69%
scripts/kbcompletion0% | 0% | 100% | 0% | 0%
crawl0% | 0% | 28% | 0% | 71%
python/fasttext_module0% | 0% | 0% | 13% | 86%
ROOT0% | 0% | 0% | 42% | 57%
webassembly0% | 0% | 0% | 0% | 100%
website/pages0% | 0% | 0% | 0% | 100%
website/static0% | 0% | 0% | 0% | 100%
python/benchmarks0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
cc
127 49 1
def align()
in alignment/unsup_multialign.py
68 27 4
int main()
in scripts/kbcompletion/eval.cpp
59 24 2
cc
bool valid_utf8()
in crawl/filter_utf8.cc
29 17 2
cc
int main()
in src/main.cc
33 16 2
cc
void Autotune::train()
in src/autotune.cc
85 16 1
cc
59 14 1
bool readWord()
in scripts/kbcompletion/eval.cpp
25 12 2
cc
bool Dictionary::readWord()
in src/dictionary.cc
24 12 2
cc
45 12 2
24 11 3
cc
void test()
in src/main.cc
45 10 1
cc
void predict()
in src/main.cc
36 10 1
cc
void ProductQuantizer::MStep()
in src/productquantizer.cc
46 10 5
34 9 1
cc
void Dictionary::prune()
in src/dictionary.cc
35 9 1
30 9 4
cc
36 9 1
43 9 1
def load_vectors()
in alignment/utils.py
24 8 5