facebookresearch / FAMBench
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 764 units with 11,883 lines of code in units (65.4% of code).
    • 2 very complex units (1,306 lines of code)
    • 5 complex units (542 lines of code)
    • 42 medium complex units (1,934 lines of code)
    • 63 simple units (2,056 lines of code)
    • 652 very simple units (6,045 lines of code)
10% | 4% | 16% | 17% | 50%
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
py14% | 6% | 14% | 16% | 48%
cc0% | 0% | 23% | 22% | 54%
cpp0% | 0% | 44% | 0% | 55%
h0% | 0% | 0% | 10% | 89%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
benchmarks/dlrm/ootb25% | 8% | 17% | 16% | 31%
benchmarks/rnnt/ootb/train13% | 5% | 8% | 16% | 55%
benchmarks/rnnt/ootb/inference0% | 1% | 17% | 17% | 63%
benchmarks/dlrm/ubench0% | 0% | 93% | 0% | 6%
benchmarks/dlrm/ootb/tools0% | 0% | 15% | 23% | 60%
benchmarks/dlrm/ootb/optim0% | 0% | 65% | 24% | 10%
benchmarks/xlmr/ootb0% | 0% | 22% | 21% | 55%
benchmarks/dlrm/ootb/tricks0% | 0% | 0% | 41% | 58%
benchmarks/cudnn_multihead_attn0% | 0% | 0% | 46% | 53%
fb5logging0% | 0% | 0% | 12% | 87%
bmlogging0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def run()
in benchmarks/dlrm/ootb/dlrm_s_pytorch.py
971 117 0
def main()
in benchmarks/rnnt/ootb/train/train.py
335 71 0
def main()
in benchmarks/rnnt/ootb/train/inference.py
143 40 0
def adagrad_optimizer()
in benchmarks/dlrm/ootb/dlrm_s_caffe2.py
129 33 8
def init_distributed()
in benchmarks/dlrm/ootb/extend_distributed.py
122 33 5
def sgd_optimizer()
in benchmarks/dlrm/ootb/dlrm_s_caffe2.py
73 31 5
def __init__()
in benchmarks/rnnt/ootb/inference/pytorch/parts/manifest.py
75 28 13
cc
std::vector GenerateQueries()
in benchmarks/rnnt/ootb/inference/loadgen/loadgen.cc
97 25 4
cc
void PerformanceSummary::LogSummary()
in benchmarks/rnnt/ootb/inference/loadgen/loadgen.cc
123 25 1
cc
void IssueQueryController::IssueQueriesInternal()
in benchmarks/rnnt/ootb/inference/loadgen/issue_query_controller.cc
163 25 2
def parallel_forward()
in benchmarks/dlrm/ootb/dlrm_s_pytorch.py
39 21 4
def forward()
in benchmarks/rnnt/ootb/inference/pytorch/parts/features.py
51 20 3
def main()
in benchmarks/dlrm/ubench/dlrm_ubench_comms_driver.py
76 19 0
cc
void PerformanceSummary::LogDetail()
in benchmarks/rnnt/ootb/inference/loadgen/loadgen.cc
90 17 1
def __getitem__()
in benchmarks/dlrm/ootb/dlrm_data_pytorch.py
30 17 2
def __getitem__()
in benchmarks/dlrm/ootb/dlrm_data_caffe2.py
26 16 2
def _load_json_manifest()
in benchmarks/rnnt/ootb/train/common/data/dataset.py
30 15 2
def create_emb()
in benchmarks/dlrm/ootb/dlrm_s_caffe2.py
70 15 5
def __getitem__()
in benchmarks/dlrm/ootb/dlrm_data_pytorch.py
49 15 2
def print_weights()
in benchmarks/dlrm/ootb/dlrm_s_pytorch.py
27 15 1