Unit Size Overall
  • There are 1,780 units with 42,351 lines of code in units (51.8% of code).
    • 73 very long units (14,446 lines of code)
    • 112 long units (8,093 lines of code)
    • 321 medium size units (9,931 lines of code)
    • 379 small units (5,522 lines of code)
    • 895 very small units (4,359 lines of code)
34% | 19% | 23% | 13% | 10%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c42% | 20% | 22% | 9% | 5%
py13% | 12% | 25% | 24% | 25%
cpp16% | 39% | 28% | 4% | 11%
pyx0% | 100% | 0% | 0% | 0%
h0% | 0% | 41% | 39% | 19%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
libvmaf41% | 20% | 22% | 9% | 6%
python12% | 12% | 24% | 24% | 24%
matlab32% | 37% | 26% | 3% | <1%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
456 19 7
454 113 27
408 36 13
406 34 6
403 36 13
374 6 9
368 35 13
360 6 9
351 37 12
348 37 12
338 34 6
320 8 3
319 80 2
316 12 7
315 17 5
311 36 12
291 171 1
286 11 5
275 8 7
272 8 3
271 6 7
227 43 10
225 16 7
220 27 6
215 27 6
208 15 5
205 12 32
181 6 8
181 6 8
174 9 14
165 26 10
156 13 5
151 32 12
150 45 3
148 24 2
148 42 5
147 20 7
142 4 9
142 12 18
142 11 5
140 35 0
140 13 11
140 41 4
138 62 2
134 18 1
134 45 6
133 13 11
133 6 7
132 50 1
123 14 10
About This Analysis
  • 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...
  • To learn more about unit size, the Sokrates recommends the following resources:
    • Function Length, MartinFowler.com
      • "If you have to spend effort into looking at a fragment of code to figure out what it's doing, then you should extract it into a function and name the function after that 'what'."
    • Stack Overflow Discussion on Unit Size, stackoverflow.com
      • "Use common sense, stick to small function sizes in most instances but don't be dogmatic about it if you have a genuinely good reason to make an unusually big function."
    • Coding Smells, codinghorror.com
      • "All other things being equal, a shorter method is easier to read, easier to understand, and easier to troubleshoot. Refactor long methods into smaller methods if you can."
    • Clean Code: A Handbook of Agile Software Craftsmanship, by Robert Martin
      • "The first rule of functions is that they should be small. The second rule of functions is that they should be smaller than that. Functions should not be 100 lines long. Functions should hardly ever be 20 lines long."