facebookresearch / xformers
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 1,032 units with 7,058 lines of code in units (47.4% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 8 medium complex units (665 lines of code)
    • 26 simple units (758 lines of code)
    • 998 very simple units (5,635 lines of code)
0% | 0% | 9% | 10% | 79%
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% | 0% | 13% | 15% | 70%
cpp0% | 0% | 0% | 7% | 92%
pyi0% | 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
xformers/benchmarks0% | 0% | 24% | 14% | 60%
xformers/sparse0% | 0% | 27% | 9% | 62%
xformers/triton0% | 0% | 16% | 20% | 62%
xformers/components0% | 0% | 0% | 7% | 92%
experimental/ragged_inference0% | 0% | 0% | 21% | 78%
xformers/factory0% | 0% | 0% | 26% | 73%
ROOT0% | 0% | 0% | 65% | 34%
xformers0% | 0% | 0% | 32% | 67%
stubs/torch0% | 0% | 0% | 0% | 100%
stubs/numpy0% | 0% | 0% | 0% | 100%
xformers/helpers0% | 0% | 0% | 0% | 100%
stubs0% | 0% | 0% | 0% | 100%
stubs/triton0% | 0% | 0% | 0% | 100%
stubs/fvcore0% | 0% | 0% | 0% | 100%
stubs/sklearn0% | 0% | 0% | 0% | 100%
stubs/matplotlib0% | 0% | 0% | 0% | 100%
stubs/recommonmark0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def benchmark()
in xformers/benchmarks/LRA/run_tasks.py
208 24 2
def __torch_function__()
in xformers/sparse/csr_tensor.py
106 22 4
def bench_linear()
in xformers/benchmarks/benchmark_triton_fused_linear.py
75 17 1
def bench_matmul()
in xformers/benchmarks/benchmark_triton_blocksparse.py
87 14 2
def bench_dropout()
in xformers/benchmarks/benchmark_triton_dropout.py
62 13 3
def _binary_op()
in xformers/sparse/csr_tensor.py
31 13 4
def backward()
in xformers/triton/k_layer_norm.py
47 12 2
def backward()
in xformers/triton/dropout.py
49 11 2
def pre_scale()
in xformers/components/attention/feature_maps/softmax.py
27 10 2
def bench_revnet()
in xformers/benchmarks/benchmark_revnet.py
52 10 1
def bench_layernorm()
in xformers/benchmarks/benchmark_triton_layernorm.py
44 10 1
def forward()
in xformers/triton/dropout.py
33 9 7
def grid_search()
in xformers/benchmarks/LRA/run_grid_search.py
92 9 1
def pretty_print()
in xformers/benchmarks/utils.py
19 9 3
def pretty_plot()
in xformers/benchmarks/utils.py
22 9 5
def __init__()
in xformers/factory/block_factory.py
23 9 3
44 8 0
def forward()
in xformers/triton/k_layer_norm.py
43 8 5
def forward()
in xformers/triton/dropout.py
12 8 2
def _register_extensions()
in xformers/__init__.py
31 8 0