pytorch / text
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 323 units with 3,535 lines of code in units (52.3% of code).
    • 0 very complex units (0 lines of code)
    • 1 complex units (82 lines of code)
    • 13 medium complex units (610 lines of code)
    • 22 simple units (564 lines of code)
    • 287 very simple units (2,279 lines of code)
0% | 2% | 17% | 15% | 64%
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
py0% | 2% | 20% | 16% | 60%
cpp0% | 0% | 6% | 8% | 84%
h0% | 0% | 0% | 53% | 46%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
benchmark0% | 22% | 20% | 30% | 26%
torchtext0% | 0% | 30% | 11% | 57%
torchtext/data0% | 0% | 21% | 29% | 48%
torchtext/vocab0% | 0% | 37% | 19% | 42%
torchtext/datasets0% | 0% | 15% | 13% | 71%
torchtext/experimental0% | 0% | 13% | 13% | 73%
torchtext/csrc0% | 0% | 6% | 12% | 81%
torchtext/nn0% | 0% | 43% | 0% | 56%
torchtext/models0% | 0% | 10% | 9% | 80%
build_tools/setup_helpers0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
torchtext/_internal0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def benchmark_mha_block()
in benchmark/mha_block.py
82 28 0
def get_tokenizer()
in torchtext/data/utils.py
72 21 2
def _run_benchmark_lookup()
in benchmark/benchmark_pytext_vocab.py
35 18 3
def WMT14()
in torchtext/experimental/datasets/raw/wmt14.py
51 18 4
def forward()
in torchtext/nn/modules/multiheadattention.py
41 18 7
def cache()
in torchtext/vocab/vectors.py
90 18 5
def IWSLT2016()
in torchtext/datasets/iwslt2016.py
68 17 4
def add_token()
in torchtext/functional.py
31 17 3
def _run_benchmark_lookup_jit_for_loop()
in benchmark/benchmark_pytext_vocab.py
39 16 4
def extract_archive()
in torchtext/utils.py
53 16 3
std::vector GPT2BPEEncoder::BPE_()
in torchtext/csrc/gpt2_bpe_tokenizer.cpp
46 15 1
def download_from_url()
in torchtext/utils.py
25 13 6
def _dataset_docstring_header()
in torchtext/data/datasets_utils.py
30 12 3
def forward()
in torchtext/models/roberta/modules.py
29 11 3
def benchmark_new_vocab_lookup()
in benchmark/benchmark_vocab.py
49 9 2
def IWSLT2017()
in torchtext/datasets/iwslt2017.py
60 9 4
def GloVe()
in torchtext/experimental/vectors.py
41 8 6
def get_model()
in torchtext/models/roberta/bundler.py
25 8 7
def _wrap_split_argument_with_fn()
in torchtext/data/datasets_utils.py
24 8 2
def __iter__()
in torchtext/data/datasets_utils.py
13 8 1