facebookresearch / phyre
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 868 units with 15,295 lines of code in units (77.0% of code).
    • 3 very long units (389 lines of code)
    • 47 long units (2,845 lines of code)
    • 238 medium size units (7,525 lines of code)
    • 173 small units (2,653 lines of code)
    • 407 very small units (1,883 lines of code)
2% | 18% | 49% | 17% | 12%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py1% | 19% | 53% | 15% | 9%
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
agents11% | 9% | 42% | 18% | 17%
src/viz/src10% | 7% | 37% | 16% | 28%
src/simulator6% | 18% | 26% | 29% | 18%
src/python/phyre0% | 18% | 51% | 16% | 12%
data/task_scripts/main0% | 26% | 61% | 11% | <1%
scripts0% | 0% | 83% | 16% | 0%
src/python0% | 0% | 48% | 44% | 6%
scripts/offline_simulation0% | 0% | 0% | 71% | 28%
src/simulator/utils0% | 0% | 0% | 45% | 54%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def train()
in agents/neural_agent.py
155 23 19
componentDidMount()
in src/viz/src/canvas.js
127 21 0
std::vector simulateTasksInParallel()
in src/simulator/task_utils_parallel.cpp
107 17 4
renderStatus()
in src/viz/src/App.js
91 16 0
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 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 add_parser_arguments()
in agents/offline_agents.py
71 1 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
def build_task()
in data/task_scripts/main/task01001.py
61 2 2
def build_task()
in src/python/phyre/data/task_scripts/main/task01001.py
61 2 2
def build_task()
in data/task_scripts/main/task00274.py
60 4 8
def build_task()
in src/python/phyre/data/task_scripts/main/task00274.py
60 4 8
inline std::vector simulateWithProcesses()
in src/simulator/benchmark_box2d.cpp
60 12 3
def build_task()
in data/task_scripts/main/task01007.py
59 2 2