facebookresearch / svg
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 200 units with 2,375 lines of code in units (76.6% of code).
    • 2 very long units (319 lines of code)
    • 5 long units (338 lines of code)
    • 19 medium size units (610 lines of code)
    • 28 small units (390 lines of code)
    • 146 very small units (718 lines of code)
13% | 14% | 25% | 16% | 30%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py13% | 14% | 25% | 16% | 30%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT32% | 26% | 25% | 10% | 4%
svg9% | 12% | 26% | 16% | 35%
svg/env0% | 0% | 20% | 25% | 54%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def run_episode()
in eval-vis-model.py
169 11 3
def make_norm_env()
in svg/utils.py
150 17 1
def plot_exp()
in svg/analysis.py
92 19 11
def plot_obs_rew()
in eval-vis-model.py
71 22 7
def run()
in train.py
68 18 1
54 3 8
def sweep()
in svg/sweeper.py
53 8 2
48 11 6
def __init__()
in svg/dx.py
45 3 17
def plot_ctrl()
in eval-vis-model.py
42 13 3
def sweep_summary()
in svg/analysis.py
41 13 1
def update()
in svg/agent.py
39 18 4
def load_data()
in svg/replay_buffer.py
39 10 2
def __init__()
in train.py
38 3 2
def update_critic()
in svg/agent.py
36 5 8
def sample_multistep()
in svg/replay_buffer.py
31 6 3
def __init__()
in svg/agent.py
28 1 0
def unroll()
in svg/dx.py
28 7 4
def evaluate()
in train.py
28 6 1
def expand_Q()
in svg/agent.py
26 3 5