facebookresearch / CrypTen
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,109 units with 8,391 lines of code in units (72.8% of code).
    • 1 very long units (115 lines of code)
    • 8 long units (511 lines of code)
    • 70 medium size units (1,977 lines of code)
    • 144 small units (2,083 lines of code)
    • 886 very small units (3,705 lines of code)
1% | 6% | 23% | 24% | 44%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py1% | 5% | 23% | 24% | 44%
js0% | 63% | 0% | 23% | 13%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
scripts38% | 26% | 16% | 12% | 4%
crypten/common0% | 8% | 20% | 36% | 34%
crypten0% | 3% | 24% | 23% | 47%
crypten/nn0% | 3% | 18% | 22% | 54%
crypten/mpc0% | 3% | 16% | 30% | 49%
benchmarks0% | 10% | 29% | 28% | 31%
crypten/communicator0% | 11% | 13% | 26% | 48%
website/pages0% | 100% | 0% | 0% | 0%
benchmarks/dash_app0% | 0% | 66% | 22% | 10%
crypten/cuda0% | 0% | 22% | 9% | 67%
tutorials0% | 0% | 90% | 0% | 10%
crypten/optim0% | 0% | 90% | 0% | 9%
crypten/debug0% | 0% | 46% | 0% | 53%
pycon-workshop-20200% | 0% | 29% | 25% | 45%
website/core0% | 0% | 0% | 64% | 35%
crypten/models0% | 0% | 0% | 24% | 75%
crypten/config0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in scripts/aws_launcher.py
115 17 0
def _adaptive_pool2d_helper()
in crypten/common/functions/pooling.py
80 19 3
def parse_args()
in scripts/aws_launcher.py
79 1 0
def backward()
in crypten/gradients.py
64 5 2
def forward()
in crypten/nn/module.py
63 32 2
def _arithmetic_function()
in crypten/mpc/primitives/arithmetic.py
59 23 6
def get_args()
in benchmarks/benchmark.py
58 1 0
def _logging()
in crypten/communicator/communicator.py
55 37 1
render()
in website/pages/en/index.js
53 1 0
def main()
in tutorials/mnist_utils.py
50 5 0
def backward()
in crypten/gradients.py
49 4 2
def run_multiprocess()
in crypten/mpc/context.py
47 14 1
def validate_correctness()
in crypten/debug/debug.py
43 12 4
def _setup_prng()
in crypten/__init__.py
39 11 0
def update_runtime_diff()
in benchmarks/dash_app/app.py
39 6 3
def update_error_diff()
in benchmarks/dash_app/app.py
39 6 3
def send()
in crypten/mpc/primitives/ot/baseOT.py
38 10 3
def backward()
in crypten/cryptensor.py
38 22 3
def graph()
in crypten/nn/tensorboard.py
37 10 1
def __beaver_protocol()
in crypten/mpc/primitives/beaver.py
34 4 5