facebookresearch / dlrm
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 175 units with 4,185 lines of code in units (61.2% of code).
    • 6 very long units (1,396 lines of code)
    • 7 long units (429 lines of code)
    • 41 medium size units (1,294 lines of code)
    • 45 small units (640 lines of code)
    • 76 very small units (426 lines of code)
33% | 10% | 30% | 15% | 10%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py33% | 10% | 30% | 15% | 10%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT34% | 9% | 27% | 16% | 11%
tools37% | 18% | 40% | 3% | 0%
tricks0% | 0% | 47% | 37% | 15%
optim0% | 0% | 65% | 24% | 10%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def run()
in dlrm_s_pytorch.py
788 132 0
def make_criteo_data_and_loaders()
in dlrm_data_pytorch.py
135 10 2
def adagrad_optimizer()
in dlrm_s_caffe2.py
129 33 8
def init_distributed()
in extend_distributed.py
122 33 5
def visualize_umap_data()
in tools/visualize.py
117 1 17
def visualize_all_data_umap()
in tools/visualize.py
105 4 6
def sgd_optimizer()
in dlrm_s_caffe2.py
73 31 5
def create_emb()
in dlrm_s_caffe2.py
70 15 5
def parallel_forward()
in dlrm_s_pytorch.py
62 25 4
def visualize_embeddings_umap()
in tools/visualize.py
60 13 6
58 5 7
def _test_bin()
in data_loader_terabyte.py
54 5 0
def hdbscan_clustering()
in tools/visualize.py
52 1 5
def step()
in optim/rwsadagrad.py
49 12 2
def create_mlp()
in dlrm_s_caffe2.py
45 11 5
def analyse_categorical_data()
in tools/visualize.py
43 4 3
def dlrm_output_wrap()
in tools/visualize.py
41 10 5
def assemble_samples()
in dlrm_data_caffe2.py
41 11 5
40 7 1
def __getitem__()
in dlrm_data_pytorch.py
39 12 2