facebookresearch / Ego-Exo
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 445 units with 7,889 lines of code in units (54.8% of code).
    • 4 very long units (667 lines of code)
    • 28 long units (2,032 lines of code)
    • 80 medium size units (2,411 lines of code)
    • 105 small units (1,571 lines of code)
    • 228 very small units (1,208 lines of code)
8% | 25% | 30% | 19% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py8% | 25% | 30% | 19% | 15%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
slowfast/models20% | 3% | 35% | 32% | 9%
tools40% | 27% | 18% | 5% | 8%
slowfast/datasets4% | 40% | 26% | 15% | 13%
tools/epic0% | 82% | 11% | 0% | 6%
slowfast/utils0% | 10% | 37% | 26% | 26%
tools/handobj0% | 82% | 11% | 0% | 6%
tools/kd0% | 81% | 11% | 0% | 6%
slowfast/visualization0% | 26% | 53% | 6% | 13%
slowfast/config0% | 0% | 75% | 21% | 3%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def demo()
in tools/demo_net.py
228 42 1
def _construct_network()
in slowfast/models/video_model_builder.py
203 5 2
def _construct_network()
in slowfast/models/video_model_builder.py
131 5 2
def __getitem__()
in slowfast/datasets/charades_aux.py
105 18 2
def __getitem__()
in slowfast/datasets/kinetics_aux.py
98 20 2
def __getitem__()
in slowfast/datasets/epic_aux.py
98 18 2
def __getitem__()
in slowfast/datasets/kinetics.py
97 20 2
def _images_and_boxes_preprocessing_cv2()
in slowfast/datasets/ava_dataset.py
90 22 3
def __getitem__()
in slowfast/datasets/charades.py
89 18 2
def __getitem__()
in slowfast/datasets/epic.py
88 18 2
def train()
in tools/epic/handobj/train_net.py
84 27 1
def train()
in tools/handobj/train_net.py
82 26 1
def train()
in tools/train_net.py
82 26 1
def train()
in tools/epic/train_net.py
81 26 1
def train()
in tools/kd/train_net.py
79 25 1
def eval_epoch()
in tools/kd/train_net.py
70 23 6
def eval_epoch()
in tools/handobj/train_net.py
70 23 6
def eval_epoch()
in tools/train_net.py
70 24 6
def _construct_loader()
in slowfast/datasets/ssv2.py
70 9 1
def eval_epoch()
in tools/epic/handobj/train_net.py
69 15 6