facebookresearch / ReAgent
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 2,129 units with 17,277 lines of code in units (52.2% of code).
    • 5 very long units (699 lines of code)
    • 21 long units (1,351 lines of code)
    • 135 medium size units (4,083 lines of code)
    • 261 small units (3,794 lines of code)
    • 1,707 very small units (7,350 lines of code)
4% | 7% | 23% | 21% | 42%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
scala63% | 0% | 26% | 7% | 1%
py2% | 7% | 22% | 22% | 45%
cpp0% | 12% | 47% | 22% | 17%
h0% | 0% | 0% | 13% | 86%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
preprocessing/src63% | 0% | 26% | 7% | 1%
reagent/training5% | 22% | 23% | 21% | 27%
reagent/evaluation11% | 17% | 30% | 17% | 23%
reagent/ope4% | 2% | 31% | 17% | 44%
serving/reagent0% | 13% | 36% | 18% | 31%
reagent/gym0% | 7% | 26% | 28% | 36%
reagent/reporting0% | 29% | 41% | 3% | 25%
reagent/replay_memory0% | 10% | 18% | 32% | 38%
reagent/models0% | 0% | 18% | 31% | 50%
reagent/core0% | 0% | 20% | 29% | 49%
reagent/preprocessing0% | 0% | 17% | 24% | 58%
reagent/lite0% | 0% | 20% | 24% | 55%
reagent/data0% | 0% | 16% | 20% | 62%
reagent/model_managers0% | 0% | 7% | 15% | 77%
reagent/model_utils0% | 0% | 36% | 0% | 63%
reagent/prediction0% | 0% | 5% | 19% | 74%
reagent/optimizer0% | 0% | 25% | 18% | 55%
reagent/workflow0% | 0% | 0% | 37% | 62%
reagent/mab0% | 0% | 0% | 14% | 85%
reagent/scripts0% | 0% | 0% | 68% | 31%
reagent/net_builder0% | 0% | 0% | 0% | 100%
reagent/publishers0% | 0% | 0% | 0% | 100%
reagent/samplers0% | 0% | 0% | 0% | 100%
reagent/validators0% | 0% | 0% | 0% | 100%
serving/scripts0% | 0% | 0% | 0% | 100%
serving0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def run()
in preprocessing/src/main/scala/com/facebook/spark/rl/Timeline.scala
199 19 2
def run()
in preprocessing/src/main/scala/com/facebook/spark/rl/MultiStepTimeline.scala
159 3 2
def train_step_gen()
in reagent/training/sac_trainer.py
136 17 3
def estimate()
in reagent/evaluation/sequential_doubly_robust_estimator.py
104 8 2
def evaluate()
in reagent/ope/estimators/sequential_estimators.py
101 15 3
def training_step()
in reagent/training/ranking/seq2slate_trainer.py
84 13 3
def evaluate()
in reagent/evaluation/world_model_evaluator.py
81 4 2
def create_for_env()
in reagent/gym/preprocessors/replay_buffer_inserters.py
78 19 2
def validate()
in reagent/evaluation/evaluation_data_page.py
77 6 1
StringDoubleMap PytorchActionValueScorer::predict()
in serving/reagent/serving/core/PytorchActionValueScorer.cpp
72 10 3
def train_step_gen()
in reagent/training/parametric_dqn_trainer.py
70 7 3
def _value_to_json()
in serving/reagent/serving/config/serialize.py
67 30 2
def _simulated_training_input()
in reagent/training/ranking/seq2slate_sim_trainer.py
66 11 2
def train_step_gen()
in reagent/training/discrete_crr_trainer.py
66 5 3
def train_step_gen()
in reagent/training/qrdqn_trainer.py
65 9 3
def aggregating_observers()
in reagent/reporting/seq2reward_reporter.py
63 4 1
def validation_step()
in reagent/training/ranking/seq2slate_attn_trainer.py
61 8 3
def train_step_gen()
in reagent/training/c51_trainer.py
60 11 3
StringOperatorDataMap OperatorRunner::run()
in serving/reagent/serving/core/OperatorRunner.cpp
58 11 4
def train_step_gen()
in reagent/training/slate_q_trainer.py
58 11 3