facebookresearch / diffq
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 91 units with 824 lines of code in units (82.4% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 10 medium size units (258 lines of code)
    • 21 small units (284 lines of code)
    • 60 very small units (282 lines of code)
0% | 0% | 31% | 34% | 34%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 0% | 33% | 30% | 35%
pyx0% | 0% | 0% | 87% | 12%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
diffq0% | 0% | 33% | 30% | 35%
ROOT0% | 0% | 0% | 87% | 12%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
31 7 3
def export()
in diffq/ts_export.py
29 5 3
def _codegen()
in diffq/ts_export.py
29 6 1
def _find_params()
in diffq/base.py
27 13 1
def _register_param()
in diffq/diffq.py
26 5 5
def __init__()
in diffq/diffq.py
25 3 14
def _unpack_param()
in diffq/ts_export.py
24 8 3
def _pre_forward_train()
in diffq/diffq.py
23 7 1
def simple_repr()
in diffq/utils.py
22 9 3
22 7 2
def model_size()
in diffq/diffq.py
20 6 2
pyx
def _pack()
in bitpack.pyx
20 6 3
def pack()
in diffq/torch_pack.py
18 5 3
pyx
def _unpack()
in bitpack.pyx
18 5 3
def __init__()
in diffq/base.py
17 1 6
def setup_optimizer()
in diffq/diffq.py
14 6 4
def _bit_unpack_param()
in diffq/diffq.py
14 3 4
def setup_optimizer()
in diffq/lsq.py
13 6 3
def uniform_quantize()
in diffq/uniform.py
13 3 2
def unpack()
in diffq/torch_pack.py
12 4 2