facebookresearch / rebel
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 246 units with 3,218 lines of code in units (69.2% of code).
    • 3 very long units (612 lines of code)
    • 5 long units (381 lines of code)
    • 25 medium size units (755 lines of code)
    • 38 small units (584 lines of code)
    • 175 very small units (886 lines of code)
19% | 11% | 23% | 18% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cc19% | 15% | 26% | 16% | 21%
py29% | 7% | 21% | 17% | 24%
h0% | 9% | 17% | 24% | 49%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
csrc/liars_dice19% | 15% | 26% | 13% | 25%
cfvpy42% | 10% | 16% | 9% | 20%
csrc/liars_dice/rela0% | 9% | 19% | 33% | 37%
heyhi0% | 0% | 31% | 29% | 39%
scripts0% | 0% | 50% | 35% | 14%
ROOT0% | 0% | 0% | 53% | 46%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def run_trainer()
in cfvpy/selfplay.py
290 70 1
cc
int main()
in csrc/liars_dice/recursive_eval.cc
221 41 2
cc
float eval_net()
in csrc/liars_dice/stats.cc
101 20 8
cc
int main()
in csrc/liars_dice/gen_benchmark.cc
98 15 2
cc
void step()
in csrc/liars_dice/subgame_solving.cc
82 20 1
cc
TreeStrategyStats compute_stategy_stats()
in csrc/liars_dice/subgame_solving.cc
73 15 2
def initialize_datagen()
in cfvpy/selfplay.py
72 11 1
SampleWeightIds sample_with_priorities_()
in csrc/liars_dice/rela/prioritized_replay.h
56 10 2
cc
void compute_strategy_recursive_to_leaf()
in csrc/liars_dice/recursive_solving.cc
50 10 7
cc
void RlRunner::sample_state_to_leaf()
in csrc/liars_dice/recursive_solving.cc
45 8 1
def _build_slurm_executor()
in heyhi/__init__.py
44 11 2
cc
void step()
in csrc/liars_dice/subgame_solving.cc
40 10 1
cc
std::vector compute_ev()
in csrc/liars_dice/subgame_solving.cc
39 8 3
def __init__()
in cfvpy/selfplay.py
38 7 2
cc
void update_regrets()
in csrc/liars_dice/subgame_solving.cc
36 10 1
def download_and_eval_all()
in scripts/eval_all.py
35 4 1
cc
void update_sum_strat()
in csrc/liars_dice/subgame_solving.cc
30 7 4
void blockAppend()
in csrc/liars_dice/rela/prioritized_replay.h
30 3 2
std::tuple sample()
in csrc/liars_dice/rela/prioritized_replay.h
29 6 2
29 9 3