facebookresearch / jps
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 289 units with 3,233 lines of code in units (75.2% of code).
    • 4 very long units (680 lines of code)
    • 3 long units (194 lines of code)
    • 19 medium size units (562 lines of code)
    • 50 small units (695 lines of code)
    • 213 very small units (1,102 lines of code)
21% | 6% | 17% | 21% | 34%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
h16% | 7% | 15% | 23% | 37%
cpp100% | 0% | 0% | 0% | 0%
cc0% | 0% | 38% | 34% | 27%
py0% | 0% | 68% | 0% | 31%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
simple_game23% | 6% | 19% | 20% | 30%
rela0% | 0% | 0% | 27% | 72%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
int main()
in simple_game/main.cpp
242 26 2
ResultAgg _search2()
in simple_game/search.h
149 35 5
AlgResult runSearch()
in simple_game/search.h
145 40 3
ResultAgg _search()
in simple_game/search.h
144 32 4
inline tabular::Policies loadPolicy()
in simple_game/game_utils.h
79 14 2
void step()
in simple_game/simple_hanabi.h
59 12 1
56 14 4
InfoSets sample()
in simple_game/search.h
47 9 0
void step()
in simple_game/two_suited_bridge.h
43 15 1
void step()
in simple_game/simple_bidding.h
40 13 1
cc
void State::buildTree()
in simple_game/search.cc
38 6 4
35 10 1
def load_policies()
in simple_game/load_strategies.py
34 11 1
std::vector legalActions()
in simple_game/simple_hanabi.h
32 11 0
def print_policy_table()
in simple_game/load_strategies.py
30 10 1
void compareReach()
in simple_game/search.h
28 4 1
cc
std::string ResultAgg::info()
in simple_game/search.cc
26 6 2
ResultAgg _bruteforceSearch()
in simple_game/search.h
26 4 4
std::string _info()
in simple_game/simple_hanabi.h
26 7 1
void buildTree()
in simple_game/cfr_opt.h
24 4 2