apple / swift-distributed-actors
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 941 units with 7,636 lines of code in units (23.1% of code).
    • 1 very long units (131 lines of code)
    • 5 long units (320 lines of code)
    • 63 medium size units (1,793 lines of code)
    • 143 small units (1,992 lines of code)
    • 729 very small units (3,400 lines of code)
1% | 4% | 23% | 26% | 44%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
swift1% | 4% | 23% | 26% | 44%
h0% | 0% | 0% | 59% | 40%
c0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Sources/SwiftBenchmarkTools29% | 0% | 33% | 10% | 26%
Sources/DistributedActors0% | 3% | 23% | 27% | 46%
Sources/DistributedActorsGenerator0% | 16% | 22% | 19% | 41%
Sources/DistributedActorsBenchmarks0% | 15% | 14% | 38% | 30%
Sources/DistributedActorsTestKit0% | 0% | 28% | 15% | 56%
Sources/ActorSingletonPlugin0% | 0% | 0% | 28% | 71%
Plugins/DistributedActorsGeneratorPlugin0% | 0% | 0% | 100% | 0%
Sources/CDistributedActorsMailbox0% | 0% | 0% | 26% | 74%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
init()
in Sources/SwiftBenchmarkTools/DriverUtils.swift
131 3 1
func renderFuncSwitchCase()
in Sources/DistributedActorsGenerator/Decls+GenActorRendering.swift
79 10 2
func sendPingRequests()
in Sources/DistributedActors/Cluster/SWIM/SWIMActorShell.swift
72 10 2
mutating func onIncomingHandshakeOffer()
in Sources/DistributedActors/Cluster/ClusterShellState.swift
62 12 3
func traverse()
in Sources/DistributedActorsBenchmarks/Protobuf/bench.pb.swift
56 18 1
func onOutboundConnectionError()
in Sources/DistributedActors/Cluster/ClusterShell.swift
51 8 4
func sendPing()
in Sources/DistributedActors/Cluster/SWIM/SWIMActorShell.swift
47 3 7
func interpretSignal()
in Sources/DistributedActors/Behaviors.swift
46 18 2
func startTrackingObjects()
in Sources/SwiftBenchmarkTools/DriverUtils.swift
46 2 1
func canonicalize0()
in Sources/DistributedActors/Behaviors.swift
44 18 4
func stopTrackingObjects()
in Sources/SwiftBenchmarkTools/DriverUtils.swift
44 2 1
mutating func applyClusterEvent()
in Sources/DistributedActors/Cluster/ClusterShellState.swift
42 11 1
func receiveOps()
in Sources/DistributedActors/Cluster/Reception/_OperationLogClusterReceptionistBehavior.swift
40 6 2
func forwarding()
in Sources/DistributedActors/Pattern/WorkerPool.swift
40 6 1
func interpretLeaderActions()
in Sources/DistributedActors/Cluster/ClusterShell+LeaderActions.swift
39 4 3
func register()
in Sources/DistributedActors/Cluster/Reception/OperationLogDistributedReceptionist.swift
39 3 2
func onDownCommand()
in Sources/DistributedActors/Cluster/ClusterShell.swift
37 4 3
func interpretSystemMessage()
in Sources/DistributedActors/_ActorShell.swift
37 14 1
func channelRead()
in Sources/DistributedActors/Cluster/Transport/TransportPipelines.swift
36 7 2
func recordMembership()
in Sources/DistributedActors/Metrics/Metrics+ActorSystem.swift
36 8 1