tensorflow / swift-models
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 656 units with 9,233 lines of code in units (32.2% of code).
    • 9 very long units (1,210 lines of code)
    • 15 long units (1,028 lines of code)
    • 86 medium size units (2,726 lines of code)
    • 129 small units (1,837 lines of code)
    • 417 very small units (2,432 lines of code)
13% | 11% | 29% | 19% | 26%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
h25% | 13% | 29% | 12% | 18%
swift4% | 9% | 29% | 24% | 32%
py0% | 0% | 46% | 35% | 17%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Support23% | 13% | 27% | 13% | 22%
Models14% | 0% | 23% | 24% | 37%
Datasets14% | 18% | 28% | 18% | 19%
Checkpoints0% | 19% | 21% | 34% | 24%
TensorBoard0% | 17% | 31% | 25% | 25%
MiniGo0% | 17% | 32% | 11% | 38%
SwiftModelsBenchmarksCore0% | 0% | 69% | 3% | 26%
Gym0% | 0% | 35% | 37% | 26%
PersonLab0% | 0% | 47% | 24% | 27%
SwiftModelsBenchmarks0% | 0% | 46% | 35% | 17%
pix2pix0% | 0% | 29% | 17% | 52%
ImageLoader0% | 0% | 0% | 85% | 14%
TrainingLoop0% | 0% | 0% | 38% | 61%
FastStyleTransfer0% | 0% | 0% | 68% | 31%
Catch0% | 0% | 0% | 41% | 58%
GAN0% | 0% | 0% | 33% | 66%
Autoencoder0% | 0% | 0% | 0% | 100%
DCGAN0% | 0% | 0% | 0% | 100%
CycleGAN0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
static int stbi_write_jpg_core()
in Support/STBImage/include/stb_image_write.h
184 34 6
static int stbi__create_png_image_raw()
in Support/STBImage/include/stb_image.h
170 57 8
static int stbi__parse_png_file()
in Support/STBImage/include/stb_image.h
154 84 3
static void stbi__idct_simd()
in Support/STBImage/include/stb_image.h
151 1 3
static void stbi__idct_simd()
in Support/STBImage/include/stb_image.h
129 1 3
func traverse()
in Models/Text/SentencePiece/SentencePieceModel.pb.swift
111 36 1
static int stbi__jpeg_decode_block_prog_ac()
in Support/STBImage/include/stb_image.h
106 30 4
init()
in Datasets/COCO/COCO.swift
104 28 3
static int stbi__parse_entropy_coded_data()
in Support/STBImage/include/stb_image.h
101 36 1
static void stbi__YCbCr_to_RGB_simd()
in Support/STBImage/include/stb_image.h
99 12 6
static int stbi__process_marker()
in Support/STBImage/include/stb_image.h
92 37 2
func decompressSnappyStream()
in Checkpoints/SnappyDecompression.swift
84 13 1
init()
in Datasets/COCO/COCO.swift
82 17 2
static void stbiw__write_hdr_scanline()
in Support/STBImage/include/stb_image_write.h
75 21 5
static int stbi_write_tga_core()
in Support/STBImage/include/stb_image_write.h
70 20 5
mutating func decodeMessage()
in TensorBoard/Protobufs/event.pb.swift
63 33 1
static int stbi__process_frame_header()
in Support/STBImage/include/stb_image.h
62 27 2
static int stbi__tga_info()
in Support/STBImage/include/stb_image.h
62 24 4
mutating func decodeMessage()
in TensorBoard/Protobufs/summary.pb.swift
61 31 1
mutating func addStone()
in MiniGo/GameLib/LibertyTracker.swift
59 7 2