facebookresearch / phyre-fwd
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 1,027 units with 17,263 lines of code in units (78.2% of code).
    • 8 very long units (1,189 lines of code)
    • 39 long units (2,460 lines of code)
    • 252 medium size units (7,929 lines of code)
    • 216 small units (3,222 lines of code)
    • 512 very small units (2,463 lines of code)
6% | 14% | 45% | 18% | 14%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py6% | 14% | 48% | 17% | 12%
js10% | 7% | 37% | 16% | 28%
cpp7% | 19% | 28% | 29% | 15%
h0% | 0% | 0% | 39% | 60%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
agents19% | 15% | 28% | 19% | 16%
src/viz10% | 7% | 37% | 16% | 28%
src/simulator6% | 17% | 25% | 30% | 19%
src/python0% | 11% | 55% | 17% | 14%
data/task_scripts0% | 18% | 66% | 13% | 1%
scripts0% | 0% | 83% | 16% | 0%
scripts/offline_simulation0% | 0% | 0% | 72% | 27%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train()
in agents/obj_fwd_agent.py
225 39 7
def train()
in agents/im_fwd_agent.py
210 39 7
def train()
in agents/neural_agent.py
167 24 20
componentDidMount()
in src/viz/src/canvas.js
127 21 0
def main()
in agents/train2.py
125 30 1
def __init__()
in agents/obj_nets.py
121 3 14
std::vector simulateTasksInParallel()
in src/simulator/task_utils_parallel.cpp
111 17 6
def eval_actions()
in agents/im_fwd_agent.py
103 12 6
renderStatus()
in src/viz/src/App.js
91 16 0
def real_eval()
in agents/offline_agents.py
87 7 9
def build_task()
in data/task_scripts/main/task00016.py
84 5 5
def build_task()
in src/python/phyre/data/task_scripts/main/task00016.py
84 5 5
def main()
in src/python/phyre/eval_task_complexity.py
82 15 5
def _roll_fwd_obs()
in agents/phyre_simulator.py
80 13 5
def add_parser_arguments()
in agents/offline_agents.py
78 1 2
def forward()
in agents/obj_nets.py
75 15 2
def build_task()
in data/task_scripts/main/task00360.py
75 7 8
def build_task()
in src/python/phyre/data/task_scripts/main/task00360.py
75 7 8
def forward()
in agents/obj_nets.py
73 8 2
def forward()
in agents/nets.py
73 17 11