apple / swift-distributed-tracing
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 50 units with 528 lines of code in units (30.6% of code).
    • 1 very long units (131 lines of code)
    • 0 long units (0 lines of code)
    • 4 medium size units (147 lines of code)
    • 3 small units (44 lines of code)
    • 42 very small units (206 lines of code)
24% | 0% | 27% | 8% | 39%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
swift24% | 0% | 27% | 8% | 39%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Sources/_TracingBenchmarkTools29% | 0% | 33% | 10% | 26%
Sources/_TracingBenchmarks0% | 0% | 0% | 0% | 100%
Sources/Tracing0% | 0% | 0% | 0% | 100%
Sources/Instrumentation0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
init()
in Sources/_TracingBenchmarkTools/DriverUtils.swift
131 3 1
func startTrackingObjects()
in Sources/_TracingBenchmarkTools/DriverUtils.swift
46 2 1
func stopTrackingObjects()
in Sources/_TracingBenchmarkTools/DriverUtils.swift
44 2 1
func run()
in Sources/_TracingBenchmarkTools/DriverUtils.swift
35 5 1
func measureMemoryUsage()
in Sources/_TracingBenchmarkTools/DriverUtils.swift
22 1 0
func measure()
in Sources/_TracingBenchmarkTools/DriverUtils.swift
17 5 2
func checked()
in Sources/_TracingBenchmarkTools/ArgParser.swift
16 3 1
func quantiles()
in Sources/_TracingBenchmarkTools/DriverUtils.swift
11 4 1
func report()
in Sources/_TracingBenchmarkTools/DriverUtils.swift
10 2 3
func startSpan()
in Sources/Tracing/Tracer.swift
9 1 4
init()
in Sources/_TracingBenchmarkTools/ArgParser.swift
9 1 1
init()
in Sources/_TracingBenchmarkTools/DriverUtils.swift
9 5 1
func iterationsPerSampleTime()
in Sources/_TracingBenchmarkTools/DriverUtils.swift
9 2 0
mutating func randInt()
in Sources/_TracingBenchmarkTools/BenchmarkTools.swift
8 2 0
func runBenchmarks()
in Sources/_TracingBenchmarkTools/DriverUtils.swift
8 2 0
func withReaderLock()
in Sources/Instrumentation/Locks.swift
7 1 1
func withWriterLock()
in Sources/Instrumentation/Locks.swift
7 1 1
func tags()
in Sources/_TracingBenchmarkTools/DriverUtils.swift
7 1 1
func quantiles()
in Sources/_TracingBenchmarkTools/DriverUtils.swift
7 2 1
func calibrateMeasurements()
in Sources/_TracingBenchmarkTools/DriverUtils.swift
6 2 0