facebookresearch / transformer-sequential
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 149 units with 1,907 lines of code in units (82.6% of code).
    • 0 very complex units (0 lines of code)
    • 1 complex units (158 lines of code)
    • 1 medium complex units (33 lines of code)
    • 13 simple units (285 lines of code)
    • 134 very simple units (1,431 lines of code)
0% | 8% | 1% | 14% | 75%
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% | 8% | 1% | 14% | 75%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
ROOT0% | 29% | 0% | 14% | 56%
models0% | 0% | 3% | 14% | 81%
utils0% | 0% | 0% | 28% | 71%
modules0% | 0% | 0% | 16% | 83%
data0% | 0% | 0% | 2% | 97%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def main()
in main.py
158 27 1
def cache_initprocess()
in models/feedback.py
33 11 2
def forward()
in models/expire_span.py
58 10 4
def trim_memory()
in modules/adaptive_span.py
27 10 5
def cache_preprocess()
in models/feedback.py
14 9 3
def cache_postprocess()
in models/feedback.py
15 8 4
def save()
in utils/checkpoint.py
23 7 5
def prepare_adapt_span()
in models/feedback.py
16 7 1
def build()
in data.py
14 7 2
def load()
in utils/checkpoint.py
22 6 5
def forward()
in models/feedback.py
30 6 4
25 6 5
16 6 1
def check_bounds()
in data/gen_data_collisions.py
4 6 4
def tokenize()
in data.py
21 6 2
def __init__()
in models/feedback.py
20 5 2
def log()
in models/expire_span.py
15 5 4
14 5 5
def check_crossings()
in data/gen_data_collisions.py
11 5 1
def generate_sample()
in data/gen_data_collisions.py
34 5 2