facebookresearch / FLSim
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 937 units with 5,278 lines of code in units (52.0% of code).
    • 0 very long units (0 lines of code)
    • 2 long units (112 lines of code)
    • 31 medium size units (838 lines of code)
    • 75 small units (1,110 lines of code)
    • 829 very small units (3,218 lines of code)
0% | 2% | 15% | 21% | 60%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 2% | 15% | 21% | 60%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
flsim/active_user_selectors0% | 24% | 21% | 28% | 25%
scripts0% | 0% | 58% | 38% | 3%
flsim/optimizers0% | 0% | 22% | 22% | 54%
flsim/utils0% | 0% | 7% | 11% | 80%
flsim/privacy0% | 0% | 26% | 28% | 44%
flsim/trainers0% | 0% | 14% | 10% | 74%
flsim/channels0% | 0% | 16% | 30% | 53%
flsim/data0% | 0% | 11% | 4% | 83%
flsim/reducers0% | 0% | 10% | 31% | 58%
flsim/clients0% | 0% | 14% | 10% | 74%
flsim/secure_aggregation0% | 0% | 29% | 14% | 55%
flsim/common0% | 0% | 0% | 31% | 68%
flsim/servers0% | 0% | 0% | 24% | 75%
flsim/interfaces0% | 0% | 0% | 35% | 64%
flsim/metrics_reporter0% | 0% | 0% | 28% | 72%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def get_user_indices()
in flsim/active_user_selectors/diverse_user_selector.py
61 8 2
def get_user_indices()
in flsim/active_user_selectors/simple_user_selector.py
51 4 2
def get_user_indices()
in flsim/active_user_selectors/diverse_user_selector.py
50 7 2
def get_user_indices()
in flsim/active_user_selectors/diverse_user_selector.py
45 7 2
def _handle_async_weight()
in scripts/old_config_converter.py
40 16 1
def _handle_aggregator()
in scripts/old_config_converter.py
34 25 1
def _handle_aggregator_reducer()
in scripts/old_config_converter.py
33 10 1
def _handle_timeout_simulator()
in scripts/old_config_converter.py
32 10 1
def step()
in flsim/optimizers/local_optimizers.py
32 10 2
def create_optimizer_for_sync_aggregator()
in flsim/optimizers/sync_aggregators.py
31 5 2
def fl_train_set()
in flsim/data/dataset_data_loader.py
30 12 2
def reduce()
in flsim/reducers/dp_round_reducer.py
29 4 1
def get_privacy_spent()
in flsim/privacy/privacy_engine.py
27 4 2
def build_data_provider()
in flsim/utils/example_utils.py
27 4 3
def _handle_active_user_selector()
in scripts/old_config_converter.py
25 11 1
def prepare_for_training()
in flsim/clients/dp_client.py
25 3 2
def __init__()
in flsim/utils/example_utils.py
25 2 4
def fl_forward()
in flsim/utils/example_utils.py
25 3 2
def fl_forward()
in flsim/utils/sample_model.py
24 3 2
def create_or_get_client_for_data()
in flsim/trainers/sync_trainer.py
23 2 3