facebookresearch / vissl
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 1,488 units with 15,929 lines of code in units (35.1% of code).
    • 1 very long units (101 lines of code)
    • 32 long units (2,125 lines of code)
    • 180 medium size units (5,254 lines of code)
    • 241 small units (3,451 lines of code)
    • 1,034 very small units (4,998 lines of code)
<1% | 13% | 32% | 21% | 31%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py<1% | 12% | 33% | 21% | 31%
js0% | 77% | 0% | 17% | 5%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
vissl/models4% | 23% | 21% | 26% | 23%
vissl/utils0% | 15% | 26% | 19% | 39%
extra_scripts0% | 33% | 37% | 19% | 10%
vissl/hooks0% | 19% | 34% | 20% | 26%
vissl/trainer0% | 16% | 34% | 21% | 27%
website/core0% | 69% | 0% | 23% | 7%
vissl/losses0% | 7% | 40% | 25% | 26%
vissl/data0% | 2% | 34% | 24% | 39%
website/pages0% | 100% | 0% | 0% | 0%
extra_scripts/datasets0% | 2% | 53% | 17% | 25%
tools0% | 0% | 50% | 23% | 26%
vissl/meters0% | 0% | 28% | 26% | 44%
vissl/optimizers0% | 0% | 29% | 27% | 43%
tools/perf_measurement0% | 0% | 45% | 11% | 42%
dev/website_docs0% | 0% | 100% | 0% | 0%
dev0% | 0% | 44% | 14% | 41%
vissl/config0% | 0% | 0% | 27% | 72%
dev/packaging0% | 0% | 0% | 24% | 75%
vissl/engines0% | 0% | 0% | 10% | 89%
ROOT0% | 0% | 0% | 0% | 100%
hydra_plugins/vissl_plugin0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def __init__()
in vissl/models/trunks/convit.py
101 9 3
def create_regnet_feature_blocks()
in vissl/models/trunks/regnet_fsdp.py
97 20 2
def infer_losses_config()
in vissl/utils/hydra_config.py
95 20 1
def standard_train_step()
in vissl/trainer/train_steps/standard_train_step.py
91 10 1
def main()
in extra_scripts/convert_vissl_to_classy_vision.py
90 3 0
def on_update()
in vissl/hooks/tensorboard_hook.py
87 15 2
def __init__()
in vissl/models/trunks/resnext.py
83 7 3
def forward()
in vissl/losses/swav_loss.py
81 14 3
def parse_config_from_log()
in extra_scripts/experiment_spreadsheet_from_logs.py
81 21 1
def infer_and_assert_hydra_config()
in vissl/utils/hydra_config.py
74 21 2
def __init__()
in vissl/models/trunks/xcit.py
71 6 3
def __init__()
in vissl/models/trunks/alexnet_deepcluster.py
70 2 3
def main()
in extra_scripts/generate_jigsaw_permutations.py
70 11 0
def run_knn_at_layer_low_memory()
in vissl/utils/knn_utils.py
68 11 2
def run_knn_at_layer()
in vissl/utils/knn_utils.py
63 14 2
def __init__()
in vissl/models/trunks/vision_transformer.py
63 8 3
def on_update()
in vissl/hooks/log_hooks.py
63 16 2
def load()
in vissl/utils/instance_retrieval_utils/data_util.py
61 19 2
def default_hook_generator()
in vissl/hooks/__init__.py
60 14 1
def __init__()
in vissl/models/trunks/alexnet_colorization.py
59 1 3