facebookresearch / PAQ
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 124 units with 1,290 lines of code in units (57.1% of code).
    • 0 very long units (0 lines of code)
    • 1 long units (57 lines of code)
    • 13 medium size units (396 lines of code)
    • 28 small units (394 lines of code)
    • 82 very small units (443 lines of code)
0% | 4% | 30% | 30% | 34%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 4% | 30% | 30% | 34%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
paq/retrievers0% | 24% | 12% | 27% | 35%
paq0% | 0% | 42% | 21% | 36%
paq/generation/question_generator0% | 0% | 76% | 11% | 11%
paq/generation/filtering0% | 0% | 27% | 23% | 48%
paq/generation/answer_extractor0% | 0% | 25% | 49% | 25%
paq/rerankers0% | 0% | 37% | 40% | 21%
paq/generation0% | 0% | 39% | 21% | 39%
paq/server0% | 0% | 50% | 31% | 17%
paq/generation/passage_scorer0% | 0% | 0% | 40% | 59%
paq/evaluation0% | 0% | 0% | 60% | 40%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def build_index_streaming()
in paq/retrievers/build_index.py
57 14 10
def download()
in paq/download.py
49 13 2
def postprocess_span2d_output()
in paq/generation/answer_extractor/span2D_model.py
48 17 5
def predict()
in paq/rerankers/rerank.py
33 8 7
def main()
in paq/download.py
32 7 0
def combine_generated_files()
in paq/generation/generate_qa_pairs.py
31 4 3
def embed()
in paq/retrievers/embed.py
29 8 6
def _batch_iterator()
in paq/generation/question_generator/generator.py
28 7 3
def do_POST()
in paq/server/server.py
26 3 1
def generate_answers()
in paq/generation/filtering/filterer.py
25 4 2
def generate_question()
in paq/generation/question_generator/generator.py
25 6 3
def generate_questions_from_passage_answer_pairs()
in paq/generation/question_generator/generator.py
25 5 3
def __init__()
in paq/generation/filtering/filterer.py
24 2 10
21 5 2
def score_passages()
in paq/generation/passage_scorer/scorer.py
19 6 3
def mips()
in paq/retrievers/retrieve.py
18 4 4
def get_vector_sample()
in paq/retrievers/build_index.py
17 3 2
def _load_index_if_exists()
in paq/retrievers/retrieve.py
17 5 5
def __init__()
in paq/generation/filtering/filterer.py
17 2 6
def __init__()
in paq/generation/answer_extractor/span2D_model.py
17 6 2