facebookresearch / ppuda
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 192 units with 3,673 lines of code in units (88.9% of code).
    • 4 very long units (526 lines of code)
    • 14 long units (940 lines of code)
    • 40 medium size units (1,217 lines of code)
    • 35 small units (497 lines of code)
    • 99 very small units (493 lines of code)
14% | 25% | 33% | 13% | 13%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py14% | 25% | 33% | 13% | 13%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
experiments75% | 19% | 5% | 0% | 0%
ppuda100% | 0% | 0% | 0% | 0%
ppuda/deepnets1m8% | 33% | 28% | 15% | 13%
ppuda/ghn0% | 29% | 40% | 24% | 5%
experiments/sgd/detector0% | 11% | 54% | 10% | 23%
experiments/sgd0% | 100% | 0% | 0% | 0%
ppuda/utils0% | 23% | 28% | 22% | 26%
ppuda/vision0% | 32% | 42% | 14% | 10%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in experiments/net_generator.py
196 41 0
def init_config()
in ppuda/config.py
122 31 1
def __init__()
in ppuda/deepnets1m/net.py
105 39 18
def main()
in experiments/train_ghn.py
103 20 0
def forward()
in ppuda/ghn/nn.py
94 46 6
def _build_graph()
in ppuda/deepnets1m/graph.py
90 40 1
def main()
in experiments/sgd/train_net.py
80 13 0
def main()
in experiments/property_prediction.py
77 15 0
def visualize()
in ppuda/deepnets1m/graph.py
73 27 8
def _construct_features()
in ppuda/deepnets1m/graph.py
68 27 1
def sample_genotype()
in ppuda/deepnets1m/genotypes.py
65 19 5
def update()
in ppuda/utils/trainer.py
63 21 6
def image_loader()
in ppuda/vision/loader.py
60 16 13
def _map_net_params()
in ppuda/ghn/nn.py
56 26 4
def _init_graph()
in ppuda/deepnets1m/loader.py
55 21 4
def get_backbone()
in experiments/sgd/detector/train_detector.py
54 11 1
def log_every()
in experiments/sgd/detector/utils.py
53 7 4
def __init__()
in ppuda/deepnets1m/loader.py
52 12 6
def loadRes()
in experiments/sgd/detector/coco_eval.py
49 20 2
def adjust_net()
in ppuda/utils/utils.py
48 18 2