facebookresearch / StarSpace
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 163 units with 2,645 lines of code in units (52.0% of code).
    • 2 very long units (337 lines of code)
    • 9 long units (594 lines of code)
    • 28 medium size units (882 lines of code)
    • 22 small units (319 lines of code)
    • 102 very small units (513 lines of code)
12% | 22% | 33% | 12% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp14% | 25% | 34% | 12% | 12%
h0% | 0% | 22% | 12% | 65%
cc0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/utils38% | 12% | 36% | 0% | 12%
src7% | 26% | 29% | 15% | 21%
src/apps0% | 0% | 92% | 0% | 7%
python0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
void Args::parseArgs()
in src/utils/args.cpp
176 74 2
Real EmbedModel::train()
in src/model.cpp
161 27 7
94 14 5
84 11 5
73 13 2
67 10 8
void StarSpace::evaluate()
in src/starspace.cpp
63 11 0
void Args::printHelp()
in src/utils/args.cpp
59 1 0
52 11 2
51 7 2
51 7 2
49 11 2
47 12 4
void StarSpace::train()
in src/starspace.cpp
44 9 0
40 11 4
int main()
in src/apps/query_predict.cpp
40 8 2
bool DataParser::parse()
in src/parser.cpp
40 11 2
39 6 2
bool LayerDataParser::parse()
in src/doc_parser.cpp
38 9 3
void foreach_line()
in src/utils/utils.h
38 7 3