facebookresearch / bitsandbytes
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 239 units with 1,459 lines of code in units (33.1% of code).
    • 1 very long units (113 lines of code)
    • 2 long units (118 lines of code)
    • 14 medium size units (442 lines of code)
    • 14 small units (201 lines of code)
    • 208 very small units (585 lines of code)
7% | 8% | 30% | 13% | 40%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py15% | 0% | 40% | 15% | 28%
h0% | 16% | 20% | 11% | 52%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
bitsandbytes/optim16% | 0% | 42% | 16% | 24%
include0% | 16% | 20% | 11% | 52%
bitsandbytes/nn0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def step()
in bitsandbytes/optim/adam.py
113 29 2
void resolve()
in include/Algo-Direct2.h
63 1 3
static HResults computeH()
in include/Algo-Direct-Common.h
55 8 2
def load_state_dict()
in bitsandbytes/optim/optimizer.py
46 21 2
def step()
in bitsandbytes/optim/lars.py
41 11 2
void vectorial()
in include/BinAlgo.h
37 11 3
def init_state()
in bitsandbytes/optim/optimizer.py
37 14 5
void resolve()
in include/Algo-Direct2.h
35 1 3
def __init__()
in bitsandbytes/optim/optimizer.py
32 9 6
def init_state()
in bitsandbytes/optim/optimizer.py
30 14 5
def override_config()
in bitsandbytes/optim/optimizer.py
29 8 5
def __init__()
in bitsandbytes/optim/optimizer.py
29 7 6
def update_step()
in bitsandbytes/optim/optimizer.py
27 9 5
void resolve()
in include/Algo-Direct2.h
26 1 3
def update_step()
in bitsandbytes/optim/optimizer.py
26 9 5
void resolve()
in include/Algo-Direct2.h
24 1 3
23 1 2
def step()
in bitsandbytes/optim/optimizer.py
19 8 2
18 5 4
static void populateIndex()
in include/Algo-Direct-Common.h
16 6 6