apple / swift-nio
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 713 units with 7,164 lines of code in units (21.1% of code).
    • 2 very long units (1,427 lines of code)
    • 8 long units (497 lines of code)
    • 27 medium size units (806 lines of code)
    • 118 small units (1,689 lines of code)
    • 558 very small units (2,745 lines of code)
19% | 6% | 11% | 23% | 38%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c90% | 0% | 1% | 1% | 6%
swift4% | 8% | 13% | 27% | 45%
h0% | 0% | 43% | 0% | 56%
rb0% | 0% | 0% | 77% | 22%
py0% | 0% | 0% | 54% | 45%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Sources/CNIOHTTPParser99% | 0% | 0% | 0% | <1%
Sources/NIOHTTP134% | 16% | 8% | 20% | 20%
Sources/NIOPosix0% | 6% | 17% | 31% | 43%
Sources/NIOPerformanceTester0% | 21% | 8% | 30% | 39%
Sources/NIOWebSocket0% | 38% | 0% | 18% | 42%
Sources/NIOCrashTester0% | 25% | 14% | 22% | 37%
Sources/NIOHTTP1Server0% | 0% | 52% | 22% | 24%
Sources/NIOCore0% | 0% | 3% | 25% | 71%
Sources/NIOAsyncAwaitDemo0% | 0% | 58% | 0% | 41%
Sources/NIOWebSocketServer0% | 0% | 81% | 0% | 18%
Sources/CNIOWindows0% | 0% | 36% | 0% | 63%
Sources/CNIOLinux0% | 0% | 29% | 0% | 70%
scripts0% | 0% | 0% | 77% | 22%
Sources/_NIODataStructures0% | 0% | 0% | 80% | 20%
dev0% | 0% | 0% | 54% | 45%
Sources/NIOTLS0% | 0% | 0% | 58% | 41%
Sources/CNIODarwin0% | 0% | 0% | 65% | 34%
Sources/NIOEmbedded0% | 0% | 0% | 18% | 81%
Sources/NIOMulticastChat0% | 0% | 0% | 0% | 100%
Sources/NIOUDPEchoClient0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
size_t c_nio_http_parser_execute()
in Sources/CNIOHTTPParser/c_nio_http_parser.c
1174 354 4
mutating func write()
in Sources/NIOHTTP1/HTTPEncoder.swift
253 121 1
func whenReady0()
in Sources/NIOPosix/SelectorUring.swift
94 17 2
init()
in Sources/NIOHTTP1/HTTPDecoder.swift
65 6 1
mutating func parseStep()
in Sources/NIOWebSocket/WebSocketFrameDecoder.swift
61 13 1
func writeExampleHTTPResponseAsString()
in Sources/NIOPerformanceTester/main.swift
60 1 1
func writeExampleHTTPResponseAsStaticString()
in Sources/NIOPerformanceTester/main.swift
60 1 1
func didFinishHead()
in Sources/NIOHTTP1/HTTPDecoder.swift
54 8 6
func whenReady0()
in Sources/NIOPosix/SelectorEpoll.swift
52 10 2
func main()
in Sources/NIOCrashTester/main.swift
51 16 0
func whenReady0()
in Sources/NIOPosix/SelectorKqueue.swift
49 9 2
func flushNow()
in Sources/NIOPosix/BaseSocketChannel.swift
44 15 0
func recvmsg()
in Sources/NIOPosix/Socket.swift
43 3 4
func feedInput()
in Sources/NIOHTTP1/HTTPDecoder.swift
38 4 1
func channelRead()
in Sources/NIOHTTP1Server/main.swift
38 8 2
func readFromSocket()
in Sources/NIOPosix/DatagramVectorReadManager.swift
37 5 3
func _read()
in Sources/NIOPosix/NonBlockingFileIO.swift
36 9 2
func sendmsg()
in Sources/NIOPosix/Socket.swift
33 1 4
func main()
in Sources/NIOAsyncAwaitDemo/main.swift
31 3 0
func dynamicHandler()
in Sources/NIOHTTP1Server/main.swift
31 11 1