facebookresearch / mvfst-rl
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 199 units with 2,597 lines of code in units (59.2% of code).
    • 1 very long units (159 lines of code)
    • 8 long units (487 lines of code)
    • 30 medium size units (859 lines of code)
    • 39 small units (536 lines of code)
    • 121 very small units (556 lines of code)
6% | 18% | 33% | 20% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py10% | 24% | 24% | 19% | 20%
cpp0% | 14% | 54% | 19% | 11%
h0% | 0% | 22% | 28% | 48%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
train13% | 28% | 17% | 21% | 18%
congestion_control0% | 14% | 50% | 19% | 15%
scripts/plotting0% | 16% | 48% | 4% | 30%
traffic_gen0% | 0% | 30% | 29% | 40%
scripts0% | 0% | 40% | 48% | 12%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def learner_loop()
in train/learner.py
159 17 5
def log_target()
in train/learner.py
75 10 3
def train()
in train/train.py
72 14 1
def normalize_rewards()
in train/learner.py
69 11 4
def forward()
in train/models.py
56 10 5
bool RLCongestionController::setNetworkState()
in congestion_control/RLCongestionController.cpp
56 6 3
def update_cmd()
in train/pantheon_env.py
55 2 4
void CongestionControlRPCEnv::loop()
in congestion_control/CongestionControlRPCEnv.cpp
53 8 1
def get_hiplot_data()
in scripts/plotting/plot_sweep.py
51 36 2
std::string NetworkState::fieldToString()
in congestion_control/NetworkState.cpp
50 22 1
int main()
in traffic_gen/main.cpp
44 11 2
void CongestionControlLocalEnv::loop()
in congestion_control/CongestionControlLocalEnv.cpp
43 5 0
def _main()
in train/learner.py
37 10 5
float CongestionControlEnv::computeReward()
in congestion_control/CongestionControlEnv.cpp
36 4 1
def test_run()
in train/pantheon_env.py
34 1 3
def augment()
in scripts/plotting/plot_sweep.py
31 10 4
quic::utils::vector CongestionControlEnv::stateSummary()
in congestion_control/CongestionControlEnv.cpp
31 3 1
def main()
in scripts/get_tperf_args.py
30 5 0
uint64_t CongestionControlEnv::getUpdatedCwndBytes()
in congestion_control/CongestionControlEnv.cpp
30 7 2
def make_gossip_buffer()
in train/train.py
27 8 4