facebookresearch / rlmeta
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 352 units with 2,175 lines of code in units (76.7% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (143 lines of code)
    • 17 medium size units (492 lines of code)
    • 27 small units (398 lines of code)
    • 306 very small units (1,142 lines of code)
0% | 6% | 22% | 18% | 52%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
h0% | 40% | 0% | 21% | 38%
py0% | 0% | 21% | 17% | 60%
cc0% | 0% | 57% | 17% | 25%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
rlmeta/cc0% | 22% | 25% | 19% | 32%
rlmeta/agents/ppo0% | 0% | 83% | 0% | 16%
rlmeta/agents/dqn0% | 0% | 57% | 12% | 29%
rlmeta/core0% | 0% | 9% | 16% | 74%
rlmeta/envs0% | 0% | 9% | 29% | 61%
ROOT0% | 0% | 42% | 51% | 5%
rlmeta/utils0% | 0% | 0% | 18% | 81%
rlmeta/agents0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
void DefineSumSegmentTree()
in rlmeta/cc/segment_tree.h
76 1 2
void DefineMinSegmentTree()
in rlmeta/cc/segment_tree.h
67 1 2
def train_step()
in rlmeta/agents/ppo/ppo_agent.py
44 3 2
cc
void DefineCircularBuffer()
in rlmeta/cc/circular_buffer.cc
39 1 1
cc
py::tuple UnbatchNestedImpl()
in rlmeta/cc/nested_utils.cc
38 9 3
def __init__()
in rlmeta/core/loop.py
37 4 12
def __init__()
in rlmeta/agents/ppo/ppo_agent.py
36 2 16
cc
py::object MapNestedImpl()
in rlmeta/cc/nested_utils.cc
29 7 2
cc
py::object CollateNestedImpl()
in rlmeta/cc/nested_utils.cc
29 4 2
def __init__()
in rlmeta/envs/atari_wrappers.py
29 4 6
def __init__()
in rlmeta/core/loop.py
27 2 10
def __init__()
in rlmeta/agents/dqn/apex_dqn_agent.py
25 1 12
def make_replay()
in rlmeta/agents/dqn/apex_dqn_agent.py
24 4 1
cc
void VisitNestedImpl()
in rlmeta/cc/nested_utils.cc
24 7 2
def train()
in rlmeta/agents/dqn/apex_dqn_agent.py
23 4 2
def __init__()
in rlmeta/agents/dqn/apex_dqn_agent.py
23 1 13
22 4 2
def make_replay()
in rlmeta/agents/ppo/ppo_agent.py
22 5 1
def train()
in rlmeta/agents/ppo/ppo_agent.py
21 3 2
def init_execution()
in rlmeta/core/loop.py
20 9 1