google / zopfli
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 433 units with 8,848 lines of code in units (84.1% of code).
    • 10 very long units (1,541 lines of code)
    • 29 long units (1,974 lines of code)
    • 79 medium size units (2,493 lines of code)
    • 116 small units (1,696 lines of code)
    • 199 very small units (1,144 lines of code)
17% | 22% | 28% | 19% | 12%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp18% | 20% | 25% | 20% | 16%
cc38% | 43% | 6% | 8% | 3%
c9% | 23% | 38% | 20% | 7%
h0% | 0% | 83% | 9% | 7%
go0% | 0% | 0% | 55% | 44%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/zopflipng/lodepng18% | 20% | 25% | 20% | 16%
src/zopflipng38% | 43% | 6% | 8% | 3%
src/zopfli9% | 21% | 41% | 19% | 7%
go/zopfli0% | 0% | 0% | 100% | 0%
go/zopflipng0% | 0% | 0% | 35% | 64%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
int main()
in src/zopflipng/zopflipng_bin.cc
275 102 2
unsigned lodepng_encode()
in src/zopflipng/lodepng/lodepng.cpp
221 86 6
unsigned lodepng_compute_color_stats()
in src/zopflipng/lodepng/lodepng.cpp
151 90 5
static void decodeGeneric()
in src/zopflipng/lodepng/lodepng.cpp
150 65 6
static unsigned deflateDynamic()
in src/zopflipng/lodepng/lodepng.cpp
136 38 7
static unsigned parseICC()
in src/zopflipng/lodepng/lodepng_util.cpp
136 37 3
static unsigned filter()
in src/zopflipng/lodepng/lodepng.cpp
132 46 6
static size_t EncodeTree()
in src/zopfli/deflate.c
119 43 8
static unsigned encodeLZ77()
in src/zopflipng/lodepng/lodepng.cpp
115 51 9
void ZopfliFindLongestMatch()
in src/zopfli/lz77.c
106 23 9
static unsigned getTreeInflateDynamic()
in src/zopflipng/lodepng/lodepng.cpp
93 31 3
static void getPixelColorsRGBA8()
in src/zopflipng/lodepng/lodepng.cpp
92 38 4
unsigned TryOptimize()
in src/zopflipng/zopflipng_lib.cc
92 27 12
int ZopfliPNGOptimize()
in src/zopflipng/zopflipng_lib.cc
89 25 4
static unsigned HuffmanTree_makeTable()
in src/zopflipng/lodepng/lodepng.cpp
82 24 1
static unsigned unfilterScanline()
in src/zopflipng/lodepng/lodepng.cpp
82 28 6
void ZopfliDeflatePart()
in src/zopfli/deflate.c
76 18 9
void ZopfliLZ77Greedy()
in src/zopfli/lz77.c
74 14 6
void ShowHelp()
in src/zopflipng/zopflipng_bin.cc
73 1 0
static double GetBestLengths()
in src/zopfli/squeeze.c
72 16 9