facebookresearch / fairring
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 77 units with 1,239 lines of code in units (49.6% of code).
    • 1 very long units (168 lines of code)
    • 4 long units (247 lines of code)
    • 13 medium size units (425 lines of code)
    • 10 small units (149 lines of code)
    • 49 very small units (250 lines of code)
13% | 19% | 34% | 12% | 20%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cc19% | 19% | 33% | 12% | 15%
py0% | 52% | 17% | 16% | 13%
h0% | 0% | 50% | 8% | 41%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
fairring16% | 15% | 40% | 6% | 20%
benchmark0% | 44% | 0% | 44% | 11%
ROOT0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
168 21 2
def main()
in benchmark/launch_benchmark.py
83 1 0
61 7 3
52 7 2
51 7 3
45 5 3
cc
void doDiffuse()
in fairring/device.cc
41 9 5
37 4 5
cc
void doReduceScatter()
in fairring/device.cc
37 5 4
cc
void doCollect()
in fairring/device.cc
35 5 5
cc
void doAllGather()
in fairring/device.cc
35 5 4
32 6 2
32 2 2
32 2 2
27 4 4
25 10 1
inline at::Tensor unUnbind()
in fairring/utils.h
24 2 1
23 3 4
19 8 1
17 3 2