facebookresearch / fbpcs
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 815 units with 9,107 lines of code in units (42.1% of code).
    • 5 very long units (682 lines of code)
    • 19 long units (1,207 lines of code)
    • 85 medium size units (2,585 lines of code)
    • 140 small units (2,039 lines of code)
    • 566 very small units (2,594 lines of code)
7% | 13% | 28% | 22% | 28%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp12% | 21% | 32% | 21% | 12%
py8% | 2% | 21% | 23% | 44%
hpp0% | 30% | 44% | 13% | 11%
h0% | 0% | 12% | 30% | 57%
java0% | 0% | 43% | 24% | 31%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
fbpcs/emp_games7% | 14% | 33% | 21% | 23%
fbpcs/private_computation_cli65% | 0% | 7% | 10% | 16%
fbpcs/data_processing8% | 33% | 22% | 19% | 16%
fbpcs/scripts0% | 31% | 16% | 30% | 21%
fbpcs/infra0% | 0% | 52% | 23% | 23%
fbpcs/pl_coordinator0% | 0% | 19% | 31% | 48%
fbpcs/pid0% | 0% | 9% | 19% | 71%
fbpcs/private_computation0% | 0% | 6% | 12% | 81%
fbpcs/utils0% | 0% | 0% | 55% | 44%
fbpcs/performance_tools0% | 0% | 0% | 72% | 27%
fbpcs/stage_flow0% | 0% | 0% | 34% | 65%
fbpcs/experimental0% | 0% | 0% | 62% | 37%
fbpcs/common0% | 0% | 0% | 16% | 83%
fbpcs/post_processing_handler0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in fbpcs/private_computation_cli/private_computation_cli.py
224 17 1
void InputData::addFromCSV()
in fbpcs/emp_games/lift/calculator/InputData.cpp
122 48 2
void LiftIdSpineFileCombiner::combineFile()
in fbpcs/data_processing/lift_id_combiner/LiftIdSpineFileCombiner.cpp
118 14 0
int main()
in fbpcs/emp_games/attribution/main.cpp
110 8 2
int main()
in fbpcs/emp_games/attribution/decoupled_aggregation/main.cpp
108 8 2
int main()
in fbpcs/emp_games/attribution/decoupled_attribution/main.cpp
92 8 2
void OutputMetrics::calculateValue()
in fbpcs/emp_games/lift/calculator/OutputMetrics.hpp
77 9 4
void groupBy()
in fbpcs/data_processing/id_combiner/GroupBy.cpp
74 12 4
AggregationOutputMetrics computeAggregations()
in fbpcs/emp_games/attribution/decoupled_aggregation/Aggregation.hpp
72 10 2
void sortIntegralValues()
in fbpcs/data_processing/id_combiner/SortIntegralValues.cpp
72 12 4
UnionPIDDataPreparerResults UnionPIDDataPreparer::prepare()
in fbpcs/data_processing/pid_preparer/UnionPIDDataPreparer.cpp
69 8 0
int main()
in fbpcs/emp_games/lift/calculator/main.cpp
68 8 2
void idSwap()
in fbpcs/data_processing/id_combiner/IdSwap.cpp
66 9 3
void GenericSharder::shard()
in fbpcs/data_processing/sharding/GenericSharder.cpp
64 9 0
def _make_input_csv()
in fbpcs/scripts/gen_fake_data.py
64 8 2
void OutputMetrics::calculateMatchCount()
in fbpcs/emp_games/lift/calculator/OutputMetrics.hpp
59 7 3
virtual void aggregateAttributions()
in fbpcs/emp_games/attribution/decoupled_aggregation/Aggregator.cpp
56 5 1
int main()
in fbpcs/emp_games/attribution/shard_aggregator/main.cpp
55 4 2
int main()
in fbpcs/data_processing/attribution_id_combiner/AttributionIdSpineCombiner.cpp
55 5 2
void attributionIdSpineFileCombiner()
in fbpcs/data_processing/attribution_id_combiner/AttributionIdSpineFileCombiner.cpp
54 6 3