facebookresearch / moolib
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 571 units with 7,057 lines of code in units (63.2% of code).
    • 5 very long units (715 lines of code)
    • 26 long units (1,766 lines of code)
    • 55 medium size units (1,762 lines of code)
    • 69 small units (1,007 lines of code)
    • 416 very small units (1,807 lines of code)
10% | 25% | 24% | 14% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cc11% | 28% | 26% | 11% | 21%
h7% | 17% | 20% | 19% | 34%
py0% | 0% | 50% | 44% | 5%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src10% | 25% | 24% | 14% | 25%
ROOT0% | 0% | 65% | 26% | 7%
py/moolib0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
int find()
in src/batchsizefinder.h
180 44 7
cc
void onRequest()
in src/rpc.cc
159 32 8
cc
void update()
in src/accumulator.cc
141 34 0
cc
void onGreeting()
in src/rpc.cc
132 32 4
cc
void onResponse()
in src/rpc.cc
103 26 8
void update()
in src/broker.h
100 27 0
cc
void reduceImpl()
in src/accumulator.cc
95 29 1
bool update()
in src/group.h
89 24 3
84 20 0
cc
void setup()
in src/accumulator.cc
81 12 0
cc
void read()
in src/rpc.cc
76 17 1
void step()
in src/env.h
74 15 3
cc
74 11 1
cc
bool handleRecv()
in src/rpc.cc
74 12 5
73 18 1
cc
py::object await()
in src/moolib.cc
72 15 0
cc
void visit()
in src/moolib.cc
72 21 2
71 11 2
cc
bool banditSend()
in src/rpc.cc
70 16 6
63 14 2