facebookresearch / NeuralDB
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 158 units with 3,004 lines of code in units (48.7% of code).
    • 7 very long units (929 lines of code)
    • 8 long units (575 lines of code)
    • 19 medium size units (646 lines of code)
    • 27 small units (392 lines of code)
    • 97 very small units (462 lines of code)
30% | 19% | 21% | 13% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py30% | 19% | 21% | 13% | 15%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
dataset-construction/src/ndb_data/generation43% | 7% | 26% | 10% | 12%
modelling/src/neuraldb42% | 27% | 13% | 9% | 7%
modelling/src/neuraldb/evaluation43% | 35% | 0% | 5% | 15%
modelling/src/neuraldb/dataset20% | 18% | 14% | 29% | 17%
ssg51% | 0% | 24% | 9% | 14%
dataset-construction/src/ndb_data/construction0% | 36% | 48% | 9% | 4%
dataset-construction/src/ndb_data/util0% | 0% | 69% | 0% | 30%
dataset-construction/src/ndb_data/data_import0% | 0% | 56% | 0% | 43%
modelling/src/neuraldb/retriever0% | 0% | 0% | 67% | 32%
dataset-construction/src/ndb_data/wikidata_common0% | 0% | 0% | 0% | 100%
dataset-construction/src/ndb_data0% | 0% | 0% | 0% | 100%
modelling/src/neuraldb/modelling0% | 0% | 0% | 0% | 100%
modelling/src/neuraldb/util0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def generate_facts_for_db()
in dataset-construction/src/ndb_data/generation/question_to_db.py
180 57 1
def main()
in modelling/src/neuraldb/run.py
170 38 0
def generate_answers()
in dataset-construction/src/ndb_data/generation/question_to_db.py
132 58 3
def generate_answers()
in modelling/src/neuraldb/convert_spj_to_predictions.py
131 57 2
def get_baseline_evaluation()
in modelling/src/neuraldb/evaluation/postprocess_baselines.py
110 25 3
def __call__()
in modelling/src/neuraldb/dataset/data_collator_seq2seq.py
105 26 2
def evaluate_ndb_with_ssg()
in ssg/evaluate_set_ssg.py
101 27 1
def _process_query()
in modelling/src/neuraldb/dataset/instance_generator/spj_generator.py
91 29 3
def get_spj_evaluation()
in modelling/src/neuraldb/evaluation/postprocess_spj.py
90 22 3
def post_process_instances()
in modelling/src/neuraldb/convert_spj_to_predictions.py
87 12 2
def build_questions_for_db()
in dataset-construction/src/ndb_data/construction/make_questions.py
86 28 1
def generate_joins_extra()
in dataset-construction/src/ndb_data/construction/make_questions.py
62 19 8
def load_experiment()
in modelling/src/neuraldb/final_scoring_with_dbsize_sweep.py
54 13 2
def load_experiment()
in modelling/src/neuraldb/final_scoring_with_dbsize.py
54 13 1
def resolve_later_ref()
in dataset-construction/src/ndb_data/generation/map_kelm.py
51 13 2
def resolve_first_ref()
in dataset-construction/src/ndb_data/generation/map_kelm.py
50 13 1
def create_dataset()
in ssg/ssg_utils.py
48 20 1
def generate_joins_filter()
in dataset-construction/src/ndb_data/construction/make_questions.py
44 21 8
def generate_derivations()
in dataset-construction/src/ndb_data/construction/make_questions.py
43 17 2
def generate_negative_bool()
in dataset-construction/src/ndb_data/construction/make_questions.py
42 14 3