facebookresearch / stochastic_gradient_push
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 161 units with 2,442 lines of code in units (85.4% of code).
    • 3 very long units (400 lines of code)
    • 8 long units (577 lines of code)
    • 21 medium size units (663 lines of code)
    • 27 small units (405 lines of code)
    • 102 very small units (397 lines of code)
16% | 23% | 27% | 16% | 16%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py16% | 23% | 27% | 16% | 16%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT33% | 36% | 16% | 8% | 4%
gossip11% | 16% | 29% | 15% | 27%
visualization0% | 36% | 55% | 6% | <1%
experiment_utils0% | 0% | 36% | 50% | 13%
gossip/utils0% | 0% | 0% | 56% | 43%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in gossip_sgd.py
143 10 0
def main()
in gossip_sgd_adpsgd.py
135 12 0
def __init__()
in gossip/distributed.py
122 25 15
def _gossip_target()
in gossip/ad_psgd.py
87 19 9
def parse_args()
in gossip_sgd_adpsgd.py
83 30 0
def __init__()
in gossip/ad_psgd.py
81 7 19
def parse_args()
in gossip_sgd.py
81 33 0
def train()
in gossip_sgd.py
71 15 11
def train()
in gossip_sgd_adpsgd.py
69 8 10
def parse_transformer_out()
in visualization/plotting.py
54 17 4
def plot_scaling()
in visualization/plotting.py
51 13 1
def get_eth_config()
in visualization/plotting.py
43 4 0
def _gossip_target()
in gossip/distributed.py
42 7 9
def __init__()
in gossip/gossiper.py
40 9 8
def mix()
in gossip/gossiper.py
40 10 4
def _query_gossip_queue()
in gossip/distributed.py
36 11 2
def plot_itrs()
in visualization/plotting.py
35 8 2
def __make_backward_hook()
in gossip/distributed.py
35 16 1
def mix()
in gossip/gossiper.py
35 11 2
def make_dataloader()
in gossip_sgd_adpsgd.py
34 2 2