facebookresearch / param
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 405 units with 5,633 lines of code in units (80.3% of code).
    • 5 very long units (583 lines of code)
    • 16 long units (1,179 lines of code)
    • 60 medium size units (1,930 lines of code)
    • 54 small units (807 lines of code)
    • 270 very small units (1,134 lines of code)
10% | 20% | 34% | 14% | 20%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py10% | 20% | 34% | 14% | 20%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
train/comms/pt12% | 22% | 35% | 15% | 14%
train/compute/python/pytorch71% | 0% | 28% | 0% | 0%
train/compute/python/lib/pytorch0% | 28% | 18% | 12% | 40%
train/compute/python/lib0% | 21% | 13% | 8% | 56%
train/compute/python/workloads/pytorch0% | 43% | 32% | 0% | 24%
train/compute/pt0% | 0% | 56% | 21% | 21%
inference/compute/pt0% | 0% | 72% | 0% | 27%
train/compute/python/tools0% | 0% | 59% | 40% | 0%
train/compute/python0% | 0% | 100% | 0% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def readArgs()
in train/comms/pt/comms.py
128 9 2
def benchTime()
in train/comms/pt/comms.py
123 17 4
def main()
in train/compute/python/pytorch/run_benchmark.py
120 11 0
def initCollectiveArgs()
in train/comms/pt/comms.py
111 10 2
def prepComm()
in train/comms/pt/comms_utils.py
101 25 3
def reportBenchTime()
in train/comms/pt/commsTraceReplay.py
99 10 2
def create_range_iter()
in train/compute/python/lib/iterator.py
97 23 2
def readArgs()
in train/comms/pt/comms_utils.py
90 7 2
def SparseDataDist()
in train/comms/pt/dlrm.py
86 10 6
def reportBenchTime()
in train/comms/pt/dlrm.py
84 18 6
def runColl()
in train/comms/pt/comms.py
78 24 4
def get_data()
in train/compute/python/workloads/pytorch/split_table_batched_embeddings_ops.py
78 17 3
def _run_ncu()
in train/compute/python/lib/pytorch/build_executor.py
78 6 1
def benchTime()
in train/comms/pt/dlrm.py
77 5 8
def materialize_arg()
in train/compute/python/lib/pytorch/data_impl.py
64 10 3
def reportBenchTimeColl()
in train/comms/pt/comms.py
60 8 4
def reportBenchTimePt2Pt()
in train/comms/pt/comms.py
60 2 4
def readArgs()
in train/comms/pt/commsTraceReplay.py
60 1 2
def benchTime()
in train/comms/pt/commsTraceReplay.py
59 22 2
def printPreamble()
in train/comms/pt/comms.py
55 4 2