facebookresearch / nevergrad
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 1,332 units with 10,402 lines of code in units (62.7% of code).
    • 2 very long units (278 lines of code)
    • 12 long units (831 lines of code)
    • 70 medium size units (2,076 lines of code)
    • 195 small units (2,776 lines of code)
    • 1,053 very small units (4,441 lines of code)
2% | 7% | 19% | 26% | 42%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py2% | 7% | 19% | 26% | 42%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
nevergrad/functions/rocket98% | 0% | 0% | 0% | 1%
nevergrad/optimization3% | 8% | 20% | 27% | 39%
nevergrad/functions/powersystems0% | 79% | 0% | 6% | 14%
nevergrad/benchmark0% | 6% | 26% | 37% | 29%
nevergrad/functions/games0% | 32% | 16% | 30% | 20%
nevergrad/functions/ml0% | 78% | 0% | 10% | 11%
nevergrad/functions/photonics0% | 19% | 28% | 21% | 30%
nevergrad/optimization/multiobjective0% | 15% | 20% | 18% | 45%
nevergrad/parametrization0% | 0% | 15% | 17% | 66%
nevergrad/functions/gym0% | 0% | 55% | 28% | 15%
nevergrad/functions/pyomo0% | 0% | 62% | 17% | 20%
nevergrad/functions/rl0% | 0% | 21% | 12% | 65%
nevergrad/functions0% | 0% | 4% | 32% | 62%
nevergrad/functions/images0% | 0% | 13% | 13% | 72%
nevergrad/functions/mlda0% | 0% | 14% | 36% | 48%
nevergrad/functions/control0% | 0% | 28% | 25% | 45%
nevergrad/common0% | 0% | 0% | 19% | 80%
nevergrad/functions/fishing0% | 0% | 0% | 75% | 25%
nevergrad/functions/unitcommitment0% | 0% | 0% | 75% | 25%
nevergrad/functions/arcoating0% | 0% | 0% | 38% | 61%
nevergrad/functions/iohprofiler0% | 0% | 0% | 48% | 51%
nevergrad/functions/mixsimulator0% | 0% | 0% | 100% | 0%
nevergrad/ops0% | 0% | 0% | 29% | 70%
nevergrad/functions/olympussurfaces0% | 0% | 0% | 28% | 71%
ROOT0% | 0% | 0% | 70% | 29%
nevergrad/functions/causaldiscovery0% | 0% | 0% | 33% | 66%
nevergrad/functions/stsp0% | 0% | 0% | 42% | 57%
nevergrad/benchmark/additional0% | 0% | 0% | 0% | 100%
nevergrad/functions/multiobjective0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def rocket()
in nevergrad/functions/rocket/rocket.py
168 25 1
def _internal_ask_candidate()
in nevergrad/optimization/optimizerlib.py
110 29 1
def yawidebbob()
in nevergrad/benchmark/experiments.py
96 41 1
def flip_play_game_nosym()
in nevergrad/functions/games/game.py
84 27 3
def make_dataset()
in nevergrad/functions/ml/mlfunctionlib.py
83 13 3
def _simulate_power_system()
in nevergrad/functions/powersystems/core.py
83 16 2
def _select_optimizer_cls()
in nevergrad/optimization/optimizerlib.py
80 45 1
def _select_optimizer_cls()
in nevergrad/optimization/optimizerlib.py
71 39 1
def make_plots()
in nevergrad/functions/powersystems/core.py
70 14 2
def tell()
in nevergrad/optimization/base.py
58 26 3
def _internal_tell_candidate()
in nevergrad/optimization/optimizerlib.py
53 16 3
def main()
in nevergrad/benchmark/plotting.py
51 4 0
def recursive_hypervolume()
in nevergrad/optimization/multiobjective/hypervolume.py
51 12 2
def morpho()
in nevergrad/functions/photonics/photonics.py
51 5 1
def _internal_ask_candidate()
in nevergrad/optimization/differentialevolution.py
49 18 1
def get_args()
in nevergrad/benchmark/__main__.py
46 1 0
def ask()
in nevergrad/optimization/base.py
46 20 1
def export_table()
in nevergrad/benchmark/exporttable.py
45 6 4
def _get_search_space()
in nevergrad/optimization/externalbo.py
44 18 2
def neural()
in nevergrad/functions/gym/multigym.py
43 8 3