facebookresearch / NeuralCompression
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 349 units with 2,561 lines of code in units (46.1% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (51 lines of code)
    • 20 medium size units (556 lines of code)
    • 45 small units (667 lines of code)
    • 283 very small units (1,287 lines of code)
0% | 1% | 21% | 26% | 50%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 2% | 20% | 26% | 51%
cc0% | 0% | 100% | 0% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
neuralcompression/layers0% | 20% | 0% | 15% | 63%
projects/deep_video_compression0% | 0% | 45% | 25% | 29%
neuralcompression/entropy_coders0% | 0% | 22% | 18% | 58%
neuralcompression/data0% | 0% | 31% | 22% | 45%
projects/scale_hyperprior_lightning0% | 0% | 35% | 31% | 32%
projects/variational_image_compression0% | 0% | 38% | 13% | 47%
neuralcompression/ext0% | 0% | 88% | 0% | 11%
neuralcompression/models0% | 0% | 4% | 30% | 65%
neuralcompression/functional0% | 0% | 0% | 47% | 52%
neuralcompression/metrics0% | 0% | 0% | 56% | 43%
neuralcompression/distributions0% | 0% | 0% | 23% | 76%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def _update()
in neuralcompression/layers/_continuous_entropy.py
51 5 1
cc
std::vector pmf_to_quantized_cdf()
in neuralcompression/ext/pmf_to_quantized_cdf_py.cc
46 11 2
def training_step()
in projects/deep_video_compression/dvc_module.py
45 10 3
def __getitem__()
in neuralcompression/data/_clic_2020_video.py
40 5 2
def run_training_stage()
in projects/deep_video_compression/train.py
34 7 7
def compute_loss_and_metrics()
in projects/deep_video_compression/dvc_module.py
32 3 3
def main()
in projects/scale_hyperprior_lightning/train.py
30 7 1
def training_step()
in projects/variational_image_compression/lightning/_prior_autoencoder.py
27 2 3
def validation_step()
in projects/deep_video_compression/dvc_module.py
27 4 3
def configure_optimizers()
in projects/deep_video_compression/dvc_module.py
25 4 1
def compute_batch_loss()
in projects/deep_video_compression/_utils.py
25 1 3
def enqueue_one_symbol()
in neuralcompression/entropy_coders/jax_arithemetic_coder.py
25 1 2
def training_step()
in projects/scale_hyperprior_lightning/scale_hyperprior.py
24 5 4
def choose_branch_and_execute()
in neuralcompression/entropy_coders/jax_arithemetic_coder.py
24 2 1
def download()
in neuralcompression/data/_clic_2020_video.py
23 3 1
def configure_optimizers()
in projects/variational_image_compression/lightning/_prior_autoencoder.py
22 1 1
def pop()
in neuralcompression/entropy_coders/craystack/codecs.py
22 1 4
def decompress()
in neuralcompression/models/deep_video_compression.py
22 2 3
def setup()
in projects/deep_video_compression/data_module.py
21 1 2
def main()
in projects/deep_video_compression/train.py
21 5 1