facebookresearch / pycls
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 351 units with 3,141 lines of code in units (49.3% of code).
    • 0 very complex units (0 lines of code)
    • 1 complex units (74 lines of code)
    • 15 medium complex units (466 lines of code)
    • 29 simple units (540 lines of code)
    • 306 very simple units (2,061 lines of code)
0% | 2% | 14% | 17% | 65%
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% | 14% | 17% | 65%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
tools0% | 19% | 43% | 20% | 16%
pycls/core0% | 0% | 13% | 26% | 59%
pycls/sweep0% | 0% | 19% | 20% | 60%
pycls/models0% | 0% | 7% | 3% | 88%
pycls/datasets0% | 0% | 0% | 32% | 67%
dev0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def sweep_analyze()
in tools/sweep_analyze.py
74 38 0
def plot_curves()
in pycls/sweep/plotting.py
43 23 5
def plot_models()
in pycls/sweep/plotting.py
47 21 4
def sweep_collect()
in tools/sweep_collect.py
34 18 0
def sample_cfgs()
in tools/sweep_setup.py
26 18 1
def sweep_setup()
in tools/sweep_setup.py
41 18 0
def load_log_data()
in pycls/core/logging.py
18 16 2
def compute_precise_bn_stats()
in pycls/core/net.py
20 15 2
def scale_model()
in pycls/models/scaler.py
28 15 0
def init_weights_vit()
in pycls/models/vit.py
28 15 1
def sort_log_data()
in pycls/core/logging.py
18 14 1
def construct_optimizer()
in pycls/core/optimizer.py
38 14 1
def train_model()
in pycls/core/trainer.py
37 14 0
def adjust_block_compatibility()
in pycls/models/blocks.py
11 13 3
def main()
in tools/sweep_launch_job.py
62 11 0
def scaling_factors()
in pycls/models/scaler.py
15 11 2
def load_checkpoint()
in pycls/core/checkpoint.py
17 10 4
def sweep_launch()
in tools/sweep_launch.py
50 9 0
def compute_time_train()
in pycls/core/benchmark.py
28 9 2
def save_checkpoint()
in pycls/core/checkpoint.py
31 9 6