facebookresearch / starcraft_defogger
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 304 units with 3,914 lines of code in units (69.5% of code).
    • 5 very long units (784 lines of code)
    • 8 long units (595 lines of code)
    • 30 medium size units (995 lines of code)
    • 41 small units (628 lines of code)
    • 220 very small units (912 lines of code)
20% | 15% | 25% | 16% | 23%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py25% | 15% | 27% | 18% | 13%
cpp21% | 28% | 32% | 12% | 5%
h0% | 0% | 9% | 12% | 77%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ROOT24% | 14% | 29% | 17% | 13%
featurizers21% | 27% | 23% | 14% | 13%
flatbuffers0% | 0% | 10% | 11% | 78%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
287 18 0
void FogOfWar::generateSightValues()
in featurizers/fogofwar.cpp
172 36 0
def setup()
in utils.py
111 19 2
def __accumulate_metrics()
in compare_models.py
110 10 6
def __init__()
in utils.py
104 10 1
def __init__()
in conv_lstm_models.py
93 15 16
void ForwardConv2DStateActionFeaturizer::featurize_unit()
in featurizers/forward_conv2d_state_action_featurizer.cpp
88 15 4
void FogOfWar::revealSightAt()
in featurizers/fogofwar.cpp
81 20 6
def __do_model_step()
in compare_models.py
80 30 8
def __update_plots()
in compare_models.py
76 8 2
def get_featurize_fn()
in conv_lstm_utils.py
69 13 2
56 9 2
Frame combine()
in featurizers/coarse_conv_featurizer.cpp
52 15 3
def __init__()
in conv_lstm_models.py
50 7 9
vector CoarseConvFeaturizer::featurize_reduced()
in featurizers/coarse_conv_featurizer.cpp
49 10 6
def __init__()
in conv_lstm_models.py
48 3 15
void CoarseConvFeaturizerUnitTypes::featurize_invfow()
in featurizers/coarse_conv_featurizer_units.cpp
45 8 5
def _run_inference()
in compare_models.py
44 18 3
void CoarseConvFeaturizerStats::featurize_unit()
in featurizers/coarse_conv_featurizer_stats.cpp
42 16 4
def __init__()
in compare_models.py
41 16 3