facebookresearch / torchbeast
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 135 units with 1,935 lines of code in units (65.7% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 3 medium complex units (414 lines of code)
    • 13 simple units (439 lines of code)
    • 119 very simple units (1,082 lines of code)
0% | 0% | 21% | 22% | 55%
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% | 28% | 13% | 58%
cc0% | 0% | 18% | 34% | 46%
h0% | 0% | 0% | 41% | 58%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
torchbeast0% | 0% | 35% | 10% | 54%
src/cc0% | 0% | 17% | 35% | 47%
nest/nest0% | 0% | 0% | 39% | 60%
torchbeast/core0% | 0% | 0% | 30% | 69%
ROOT0% | 0% | 0% | 0% | 100%
nest0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def train()
in torchbeast/monobeast.py
161 24 1
def train()
in torchbeast/polybeast_learner.py
165 24 1
cc
void loop()
in src/cc/actorpool.cc
88 13 2
cc
static int aten_to_dtype()
in src/cc/actorpool.cc
26 10 1
cc
void enqueue()
in src/cc/actorpool.cc
33 9 1
def gather_metadata()
in torchbeast/core/file_writer.py
33 8 0
def log()
in torchbeast/core/file_writer.py
23 8 4
return std::visit()
in nest/nest/nest.h
45 8 2
static void for_each()
in nest/nest/nest.h
41 8 3
def wrap_deepmind()
in torchbeast/atari_wrappers.py
13 6 5
def forward()
in torchbeast/monobeast.py
41 6 3
def forward()
in torchbeast/polybeast_learner.py
41 6 3
bool load()
in nest/nest/nest_pybind.h
17 6 2
72 6 2
std::invoke_result_t nest_pb_to_nest()
in src/cc/nest_serialize.h
22 6 2
cc
void set_outputs()
in src/cc/actorpool.cc
32 6 1
def step()
in torchbeast/atari_wrappers.py
8 5 2
def step()
in torchbeast/atari_wrappers.py
12 5 2
def observation()
in torchbeast/atari_wrappers.py
18 5 2
def main()
in torchbeast/polybeast_env.py
15 5 1