apple / swift-collections-benchmark
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 97 units with 965 lines of code in units (14.3% of code).
    • 1 very long units (133 lines of code)
    • 2 long units (150 lines of code)
    • 5 medium size units (136 lines of code)
    • 11 small units (156 lines of code)
    • 78 very small units (390 lines of code)
13% | 15% | 14% | 16% | 40%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
swift13% | 15% | 14% | 16% | 40%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Sources/CollectionsBenchmark/BenchmarkCLI30% | 34% | 17% | 9% | 7%
Sources/CollectionsBenchmark/Benchmark0% | 0% | 36% | 0% | 63%
Sources/CollectionsBenchmark/Charts/Graphics0% | 0% | 22% | 51% | 26%
Sources/CollectionsBenchmark/Charts0% | 0% | 0% | 41% | 58%
Sources/CollectionsBenchmark/Utilities0% | 0% | 0% | 10% | 89%
Sources/CollectionsBenchmark/Basics0% | 0% | 0% | 53% | 46%
Sources/CollectionsBenchmark/Charts/Renderers0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func run()
in Sources/CollectionsBenchmark/BenchmarkCLI/BenchmarkCLI+Results+Compare.swift
133 16 0
func run()
in Sources/CollectionsBenchmark/BenchmarkCLI/BenchmarkCLI+Library+Render.swift
82 11 1
mutating func run()
in Sources/CollectionsBenchmark/BenchmarkCLI/_Document.swift
68 16 2
func markdown()
in Sources/CollectionsBenchmark/Benchmark/Benchmark+ChartLibrary.swift
37 6 1
init?()
in Sources/CollectionsBenchmark/BenchmarkCLI/BenchmarkCLI+Results+Compare.swift
30 5 2
func run()
in Sources/CollectionsBenchmark/BenchmarkCLI/BenchmarkCLI+Render.swift
26 2 0
func run()
in Sources/CollectionsBenchmark/BenchmarkCLI/BenchmarkCLI+Results+ListTasks.swift
22 6 0
func _svgString()
in Sources/CollectionsBenchmark/Charts/Graphics/Graphics+SVG.swift
21 6 0
func htmlString()
in Sources/CollectionsBenchmark/Charts/Graphics/Graphics+SVG.swift
20 1 0
func renderText()
in Sources/CollectionsBenchmark/Charts/Graphics/Graphics+SVG.swift
17 3 1
func draw()
in Sources/CollectionsBenchmark/BenchmarkCLI/BenchmarkCLI+Library+Render.swift
15 1 1
func curve()
in Sources/CollectionsBenchmark/Basics/TaskResults.swift
14 4 3
mutating func merge()
in Sources/CollectionsBenchmark/BenchmarkCLI/_Document.swift
14 6 2
func timeScale()
in Sources/CollectionsBenchmark/Charts/Chart+Options.swift
14 2 2
func chartOptions()
in Sources/CollectionsBenchmark/BenchmarkCLI/BenchmarkCLI+Render+Options.swift
13 1 0
mutating func updateValue()
in Sources/CollectionsBenchmark/Utilities/_SimpleSortedDictionary.swift
13 2 2
func sizeScale()
in Sources/CollectionsBenchmark/Charts/Chart+Options.swift
12 2 2
func render()
in Sources/CollectionsBenchmark/Charts/Graphics/Renderer.swift
12 1 3
mutating func _update()
in Sources/CollectionsBenchmark/Utilities/_SimpleOrderedSet.swift
12 1 2
func _sourceLink()
in Sources/CollectionsBenchmark/Benchmark/Benchmark+Links.swift
10 1 1