facebookresearch / rela
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 201 units with 2,100 lines of code in units (63.2% of code).
    • 0 very long units (0 lines of code)
    • 3 long units (209 lines of code)
    • 19 medium size units (565 lines of code)
    • 38 small units (560 lines of code)
    • 141 very small units (766 lines of code)
0% | 9% | 26% | 26% | 36%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 16% | 17% | 28% | 37%
h0% | 5% | 32% | 24% | 37%
cc0% | 0% | 57% | 26% | 15%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
pyrela0% | 23% | 24% | 21% | 30%
rela0% | 5% | 33% | 25% | 35%
atari0% | 0% | 45% | 23% | 31%
pyrela/common_utils0% | 0% | 0% | 45% | 54%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def benchmark_fps()
in pyrela/benchmark.py
96 7 1
def parse_log()
in pyrela/parse_log.py
61 12 2
SampleWeightIds sample_()
in rela/prioritized_replay.h
52 8 2
void push()
in rela/r2d2_actor.h
44 10 3
def parse_args()
in pyrela/main.py
43 1 0
FFTransition popTransition()
in rela/dqn_actor.h
39 8 0
39 3 2
35 3 2
std::tuple step()
in atari/atari_env.h
33 7 1
def analyze_sweep()
in pyrela/analyze_sweep.py
31 6 4
29 7 2
void blockAppend()
in rela/prioritized_replay.h
28 2 2
torch::Tensor computeFeature()
in atari/game_state.h
27 4 0
def parse_from_root()
in pyrela/parse_log.py
27 9 4
std::tuple sample()
in rela/prioritized_replay.h
27 5 2
virtual void mainLoop()
in rela/thread_loop.h
26 7 0
virtual void postStep()
in rela/r2d2_actor.h
25 3 0
def to_device()
in pyrela/utils.py
24 6 2
virtual TensorDict act()
in rela/r2d2_actor.h
23 3 1
rela::TensorDict reset()
in atari/atari_env.h
22 3 0