facebookresearch / EGG
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 660 units with 7,579 lines of code in units (70.6% of code).
    • 8 very long units (1,125 lines of code)
    • 16 long units (1,099 lines of code)
    • 61 medium size units (1,878 lines of code)
    • 89 small units (1,246 lines of code)
    • 486 very small units (2,231 lines of code)
14% | 14% | 24% | 16% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py14% | 14% | 24% | 16% | 29%
pl0% | 0% | 0% | 44% | 56%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
egg/zoo/objects_game52% | 11% | 8% | 13% | 14%
egg/zoo/channel73% | 0% | 8% | 3% | 13%
egg/zoo/compo_vs_generalization36% | 9% | 9% | 19% | 24%
egg/zoo/language_bottleneck14% | 20% | 24% | 15% | 24%
egg/zoo/basic_games42% | 29% | 7% | 7% | 13%
egg/zoo/external_game58% | 0% | 11% | 7% | 22%
egg/core0% | 10% | 23% | 22% | 43%
egg/zoo/simple_autoenc0% | 77% | 0% | 5% | 17%
egg/zoo/emcom_as_ssl0% | 15% | 49% | 7% | 26%
egg/zoo/summation0% | 32% | 16% | 25% | 24%
egg/zoo/compositional_efficiency0% | 20% | 35% | 4% | 39%
egg/zoo/simclr0% | 15% | 22% | 22% | 38%
egg/zoo/dsprites_bvae0% | 0% | 50% | 21% | 28%
egg/zoo/signal_game0% | 0% | 43% | 34% | 21%
egg/zoo/mnist_vae0% | 0% | 56% | 15% | 28%
egg/zoo/mnist_autoenc0% | 0% | 65% | 0% | 34%
egg/zoo/template0% | 0% | 23% | 12% | 64%
egg/nest0% | 0% | 0% | 77% | 22%
scripts0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in egg/zoo/compo_vs_generalization/train.py
199 12 1
def main()
in egg/zoo/language_bottleneck/guess_number/train.py
153 9 1
def main()
in egg/zoo/objects_game/train.py
148 15 1
def get_params()
in egg/zoo/objects_game/train.py
146 1 1
def main()
in egg/zoo/basic_games/play.py
137 43 1
def get_params()
in egg/zoo/channel/train.py
122 1 1
def get_params()
in egg/zoo/external_game/game.py
119 1 0
def main()
in egg/zoo/channel/train.py
101 7 1
def get_params()
in egg/zoo/basic_games/play.py
94 2 1
def _populate_cl_params()
in egg/core/util.py
93 1 1
def main()
in egg/zoo/emcom_as_ssl/train.py
92 11 1
def get_params()
in egg/zoo/simple_autoenc/train.py
89 1 1
def get_params()
in egg/zoo/language_bottleneck/guess_number/train.py
88 3 1
def main()
in egg/zoo/simple_autoenc/train.py
76 4 1
def intervention_message()
in egg/zoo/language_bottleneck/intervention.py
69 12 2
def get_iterators()
in egg/zoo/objects_game/features.py
62 9 1
def maybe_init_distributed()
in egg/core/distributed.py
58 7 1
def main()
in egg/zoo/language_bottleneck/mnist_overfit/train.py
57 9 1
def get_params()
in egg/zoo/summation/train.py
55 1 0
def main()
in egg/zoo/emcom_as_ssl/scripts/kmeans_analysis.py
55 3 0