microsoft / nni
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 4,511 units with 49,294 lines of code in units (74.6% of code).
    • 10 very long units (1,664 lines of code)
    • 84 long units (5,631 lines of code)
    • 515 medium size units (15,479 lines of code)
    • 871 small units (12,576 lines of code)
    • 3,031 very small units (13,944 lines of code)
3% | 11% | 31% | 25% | 28%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py2% | 10% | 30% | 26% | 29%
ts3% | 13% | 35% | 21% | 25%
tsx10% | 22% | 28% | 20% | 17%
js0% | 21% | 30% | 25% | 23%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ts/nni_manager3% | 14% | 35% | 21% | 25%
nni/retiarii6% | 3% | 27% | 20% | 41%
nni/tools6% | 18% | 24% | 30% | 20%
nni/experiment19% | 0% | 21% | 24% | 34%
ts/webui5% | 16% | 30% | 24% | 23%
nni/algorithms1% | 10% | 34% | 27% | 26%
nni/compression0% | 12% | 24% | 36% | 26%
nni/nas0% | 11% | 24% | 25% | 38%
nni/common0% | 14% | 39% | 20% | 25%
nni0% | 10% | 20% | 18% | 49%
nni/runtime0% | 0% | 23% | 36% | 39%
ROOT0% | 0% | 30% | 23% | 45%
ts/jupyter_extension0% | 0% | 69% | 30% | 0%
nni/feature_engineering0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def handle_graph_nodes()
in nni/retiarii/converter/graph_gen.py
253 50 9
def to_v2()
in nni/experiment/config/convert.py
219 42 1
private async trialManagementLoop()
in ts/nni_manager/training_service/reusable/trialDispatcher.ts
204 57 0
def parse_args()
in nni/tools/nnictl/nnictl.py
193 10 0
private _buildColumnsFromTableItems()
in ts/webui/src/components/trial-detail/TableList.tsx
186 18 1
def _selection()
in nni/algorithms/hpo/metis_tuner/metis_tuner.py
167 11 12
public scheduleMachine()
in ts/nni_manager/training_service/reusable/gpuScheduler.ts
117 30 4
public async submitTrialJob()
in ts/nni_manager/training_service/kubernetes/adl/adlTrainingService.ts
114 12 1
def launch_experiment()
in nni/tools/nnictl/legacy_launcher.py
110 41 5
def assemble()
in nni/retiarii/execution/logical_optimizer/logical_plan.py
101 20 3
def __init__()
in nni/algorithms/feature_engineering/gradient_selector/fginitialize.py
98 19 18
def load_experiment()
in nni/tools/nnictl/nnictl_utils.py
98 21 1
def __init__()
in nni/algorithms/feature_engineering/gradient_selector/learnability.py
95 15 12
def fix_mask()
in nni/compression/pytorch/utils/mask_conflict.py
94 38 1
private renderParallelCoordinates()
in ts/webui/src/components/trial-detail/Para.tsx
90 17 0
def build_engine()
in nni/compression/pytorch/quantization_speedup/integrated_tensorrt.py
89 30 5
function batchFormat()
in ts/webui/src/static/json_util.ts
89 14 5
def parse_annotation_mutable_layers()
in nni/tools/annotation/code_generator.py
88 16 3
private generateTaskRoleConfig()
in ts/nni_manager/training_service/kubernetes/frameworkcontroller/frameworkcontrollerTrainingService.ts
88 6 6
def __init__()
in nni/algorithms/compression/pytorch/pruning/amc/amc_pruner.py
87 5 33