apple / ml-gsn
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 167 units with 2,139 lines of code in units (65.1% of code).
    • 0 very long units (0 lines of code)
    • 6 long units (361 lines of code)
    • 19 medium size units (554 lines of code)
    • 46 small units (668 lines of code)
    • 96 very small units (556 lines of code)
0% | 16% | 25% | 31% | 25%
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% | 26% | 31% | 25%
cpp0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
models0% | 15% | 22% | 35% | 26%
datasets0% | 48% | 21% | 19% | 10%
ROOT0% | 100% | 0% | 0% | 0%
models/op0% | 0% | 41% | 27% | 31%
utils0% | 0% | 28% | 30% | 40%
builders0% | 0% | 75% | 0% | 24%
options0% | 0% | 52% | 25% | 22%
notebooks0% | 0% | 0% | 77% | 22%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def forward()
in models/generator.py
72 8 4
def __init__()
in models/generator.py
67 10 7
def __getitem__()
in datasets/replica.py
61 7 2
def backproject()
in models/backprojection_utils.py
54 11 9
def main()
in train_gsn.py
54 6 1
def __getitem__()
in datasets/vizdoom.py
53 7 2
def generate()
in models/gsn.py
44 11 3
def sample_trajectories()
in models/model_utils.py
43 4 3
def forward()
in models/losses.py
40 6 7
def forward()
in models/layers.py
35 6 3
def build_dataloader()
in builders/builders.py
34 7 2
def upfirdn2d()
in models/op/native_ops.py
33 1 6
def forward()
in models/op/upfirdn2d.py
31 1 10
def sample_pdf_2()
in models/nerf_utils.py
28 2 4
def get_floorplans()
in utils/callbacks.py
28 5 5
def torch_cov()
in utils/fid.py
27 7 2
def get_trajectory_Rt()
in datasets/replica.py
25 7 1
def get_trajectory_Rt()
in datasets/vizdoom.py
25 7 1
def __init__()
in models/generator.py
25 3 8
def DiffAugment()
in models/diff_augment.py
23 10 4