facebookresearch / DynamicsAware
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 961 units with 17,225 lines of code in units (77.5% of code).
    • 4 very long units (789 lines of code)
    • 52 long units (3,232 lines of code)
    • 261 medium size units (8,249 lines of code)
    • 184 small units (2,830 lines of code)
    • 460 very small units (2,125 lines of code)
4% | 18% | 47% | 16% | 12%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py3% | 19% | 51% | 14% | 10%
js10% | 7% | 37% | 16% | 28%
cpp7% | 20% | 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
agents18% | 14% | 40% | 12% | 14%
src/viz10% | 7% | 37% | 16% | 28%
src/simulator6% | 18% | 25% | 30% | 19%
src/python0% | 18% | 51% | 16% | 12%
data/task_scripts0% | 26% | 61% | 11% | <1%
agents/report_web_viewer0% | 35% | 29% | 16% | 18%
scripts0% | 0% | 83% | 16% | 0%
scripts/offline_simulation0% | 0% | 0% | 71% | 28%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train()
in agents/neural_agent.py
285 49 26
def train_single_proc()
in agents/neural_agent_contrastive.py
270 50 29
componentDidMount()
in src/viz/src/canvas.js
127 21 0
std::vector simulateTasksInParallel()
in src/simulator/task_utils_parallel.cpp
107 17 4
def add_parser_arguments()
in agents/offline_agents.py
93 1 2
renderStatus()
in src/viz/src/App.js
91 16 0
def __init__()
in agents/nets.py
88 17 10
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 __init__()
in agents/psim.py
76 10 8
def build_task()
in data/task_scripts/main/task01002.py
76 4 2
def build_task()
in src/python/phyre/data/task_scripts/main/task01002.py
76 4 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 real_eval()
in agents/offline_agents.py
71 13 13
def auccess_report()
in agents/report_web_viewer/img_browse.py
69 21 2
def translate_to_phyre()
in src/python/phyre/virtual_tools.py
65 18 2
def segs2poly()
in src/python/phyre/virtual_tools.py
63 20 2
auto magic_ponies()
in src/simulator/simulator_bindings.cpp
63 12 8