facebookresearch / narwhal
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 201 units with 2,148 lines of code in units (37.5% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (117 lines of code)
    • 28 medium size units (931 lines of code)
    • 27 small units (379 lines of code)
    • 144 very small units (721 lines of code)
0% | 5% | 43% | 17% | 33%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 6% | 46% | 14% | 32%
rs0% | 0% | 31% | 30% | 37%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
benchmark0% | 6% | 46% | 14% | 32%
worker0% | 0% | 100% | 0% | 0%
consensus0% | 0% | 31% | 68% | 0%
primary0% | 0% | 0% | 27% | 72%
config0% | 0% | 0% | 65% | 34%
network0% | 0% | 0% | 36% | 63%
crypto0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def run()
in benchmark/benchmark/local.py
66 14 2
def run()
in benchmark/benchmark/remote.py
51 12 4
def _run_single()
in benchmark/benchmark/remote.py
48 11 5
def create_instances()
in benchmark/benchmark/instance.py
44 8 2
def result()
in benchmark/benchmark/logs.py
44 1 1
fn handle_clients_transactions()
in worker/src/worker.rs
44 1 2
def __init__()
in benchmark/benchmark/logs.py
42 10 5
def __init__()
in benchmark/benchmark/config.py
39 10 3
def plot_latency()
in benchmark/data/paper-data/plot-script.py
38 8 6
def _config()
in benchmark/benchmark/remote.py
37 12 4
def _create_security_group()
in benchmark/benchmark/instance.py
36 1 2
def print()
in benchmark/benchmark/aggregate.py
36 6 1
def plot()
in benchmark/benchmark/plot.py
36 11 2
def plot_tps()
in benchmark/data/paper-data/plot-script.py
35 7 7
fn handle_workers_messages()
in worker/src/worker.rs
35 1 2
def _plot()
in benchmark/benchmark/plot.py
34 7 6
def _parse_primaries()
in benchmark/benchmark/logs.py
34 4 2
def print()
in benchmark/data/paper-data/plot-script.py
34 4 1
def __init__()
in benchmark/benchmark/config.py
33 18 2
fn order_dag()
in consensus/src/lib.rs
33 5 3