facebookresearch / fairscale
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 3,052 units with 11,371 lines of code in units (63.2% of code).
    • 0 very complex units (0 lines of code)
    • 3 complex units (156 lines of code)
    • 46 medium complex units (1,687 lines of code)
    • 88 simple units (1,579 lines of code)
    • 2,915 very simple units (7,949 lines of code)
0% | 1% | 14% | 13% | 69%
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% | 1% | 18% | 17% | 62%
pyi0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
fairscale/nn0% | 4% | 11% | 15% | 68%
fairscale/experimental0% | 0% | 19% | 20% | 59%
fairscale/optim0% | 0% | 33% | 26% | 39%
benchmarks/experimental0% | 0% | 19% | 9% | 70%
fairscale/utils0% | 0% | 29% | 16% | 54%
benchmarks0% | 0% | 31% | 13% | 55%
ROOT0% | 0% | 0% | 36% | 63%
benchmarks/datasets0% | 0% | 0% | 22% | 77%
stubs/torch0% | 0% | 0% | 0% | 100%
benchmarks/golden_configs0% | 0% | 0% | 0% | 100%
benchmarks/models0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def _wait_for_post_backward()
in fairscale/nn/data_parallel/fully_sharded_data_parallel.py
50 42 1
def _rebuild_full_params()
in fairscale/nn/data_parallel/fully_sharded_data_parallel.py
67 38 2
def _post_backward_hook()
in fairscale/nn/data_parallel/fully_sharded_data_parallel.py
39 27 3
def train()
in benchmarks/pipe.py
78 25 5
def step()
in fairscale/optim/adam.py
77 24 3
def _init_param_attributes()
in fairscale/nn/data_parallel/fully_sharded_data_parallel.py
32 23 2
def _split_nodes()
in fairscale/experimental/nn/auto_shard.py
41 22 2
def objects_are_equal()
in fairscale/utils/testing.py
45 22 4
def forward()
in fairscale/experimental/nn/offload.py
34 20 4
def backward()
in fairscale/experimental/nn/offload.py
57 20 2
def create_graph()
in fairscale/experimental/nn/distributed_pipeline/trace.py
43 19 1
def forward()
in fairscale/nn/data_parallel/fully_sharded_data_parallel.py
21 18 3
def _set_is_root()
in fairscale/nn/data_parallel/fully_sharded_data_parallel.py
16 17 1
def _register_pre_backward_hooks()
in fairscale/nn/data_parallel/fully_sharded_data_parallel.py
30 17 2
def _init_global_momentum_buffers()
in fairscale/experimental/nn/data_parallel/gossip/distributed.py
39 16 2
def _split()
in fairscale/experimental/nn/offload.py
24 16 2
def scale()
in fairscale/optim/grad_scaler.py
28 16 3
def forward()
in fairscale/experimental/nn/mevo.py
51 15 3
def __new__()
in fairscale/nn/misc/flatten_params_wrapper.py
9 15 3
def summon_full_params()
in fairscale/nn/data_parallel/fully_sharded_data_parallel.py
46 15 3