facebookresearch / ClassyVision
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 823 units with 7,693 lines of code in units (56.0% of code).
    • 1 very long units (195 lines of code)
    • 9 long units (551 lines of code)
    • 67 medium size units (2,011 lines of code)
    • 155 small units (2,193 lines of code)
    • 591 very small units (2,743 lines of code)
2% | 7% | 26% | 28% | 35%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py2% | 6% | 25% | 29% | 36%
js0% | 37% | 42% | 13% | 7%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
classy_vision/generic22% | 0% | 2% | 19% | 54%
classy_vision/tasks0% | 16% | 39% | 14% | 29%
classy_vision/models0% | 6% | 14% | 42% | 37%
classy_vision/distributed0% | 70% | 16% | 8% | 4%
classy_vision/hooks0% | 11% | 23% | 34% | 30%
website/core0% | 27% | 42% | 19% | 10%
website/pages0% | 59% | 40% | 0% | 0%
classy_vision/dataset0% | 0% | 38% | 25% | 35%
classy_vision/optim0% | 0% | 55% | 8% | 35%
scripts0% | 0% | 100% | 0% | 0%
ROOT0% | 0% | 87% | 0% | 12%
classy_vision/heads0% | 0% | 30% | 24% | 44%
classy_vision/losses0% | 0% | 21% | 34% | 44%
classy_vision/meters0% | 0% | 7% | 58% | 33%
classy_vision/templates0% | 0% | 43% | 0% | 56%
classy_vision/trainer0% | 0% | 0% | 50% | 49%
classy_vision/hub0% | 0% | 0% | 0% | 100%
hydra_plugins/classy_vision_path0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def _layer_flops()
in classy_vision/generic/profiler.py
195 33 3
def from_config()
in classy_vision/tasks/classification_task.py
82 12 3
def on_phase_end()
in classy_vision/hooks/tensorboard_plot_hook.py
72 20 2
def _parse_config()
in classy_vision/models/resnext3d.py
65 11 1
def prepare()
in classy_vision/tasks/classification_task.py
61 18 1
def parse_args()
in classy_vision/distributed/launch_ray.py
57 2 0
def __init__()
in classy_vision/models/anynet.py
57 5 2
render()
in website/core/TutorialSidebar.js
55 2 0
render()
in website/pages/en/index.js
51 3 0
def run()
in classy_vision/distributed/launch_ray.py
51 13 6
def set_classy_state()
in classy_vision/models/vision_transformer.py
50 7 3
def step()
in classy_vision/optim/rmsprop_tf.py
48 12 2
render()
in website/core/Footer.js
47 4 0
def __init__()
in classy_vision/tasks/classification_task.py
47 1 1
def train_step()
in classy_vision/tasks/classification_task.py
45 11 1
def init_distributed_data_parallel_model()
in classy_vision/tasks/classification_task.py
44 8 1
def from_config()
in classy_vision/dataset/classy_hmdb51.py
42 3 3
def from_config()
in classy_vision/dataset/classy_kinetics400.py
42 2 3
def from_config()
in classy_vision/dataset/classy_ucf101.py
42 3 3
def on_start()
in classy_vision/hooks/model_complexity_hook.py
41 7 2