apple / swift-protobuf
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 6,604 units with 65,619 lines of code in units (34.5% of code).
    • 36 very long units (17,020 lines of code)
    • 79 long units (5,086 lines of code)
    • 212 medium size units (6,771 lines of code)
    • 242 small units (3,359 lines of code)
    • 6,035 very small units (33,383 lines of code)
25% | 7% | 10% | 5% | 50%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
swift26% | 7% | 10% | 5% | 51%
js0% | 39% | 50% | 0% | 10%
h0% | 0% | 81% | 18% | 0%
py0% | 0% | 64% | 27% | 8%
cc0% | 0% | 0% | 100% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Reference24% | 1% | 1% | 1% | 71%
Reference/google42% | 10% | 13% | 8% | 24%
FuzzTesting/Sources100% | 0% | 0% | 0% | 0%
Sources/Conformance27% | 18% | 31% | 6% | 16%
Sources/SwiftProtobuf0% | 25% | 36% | 16% | 22%
Sources/protoc-gen-swift0% | 30% | 43% | 9% | 16%
Performance/js0% | 39% | 50% | 0% | 10%
Reference/conformance0% | 28% | 49% | 4% | 17%
Performance0% | 31% | 27% | 36% | 3%
Sources/SwiftProtobufPluginLibrary0% | 0% | 31% | 22% | 45%
DevTools0% | 0% | 64% | 27% | 8%
Reference/SwiftProtobufPluginLibrary0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
func traverse()
in Reference/google/protobuf/unittest_enormous_descriptor.pb.swift
3005 1001 1
func traverse()
in Reference/generated_swift_names_fields.pb.swift
2612 870 1
mutating func decodeMessage()
in Reference/google/protobuf/unittest_enormous_descriptor.pb.swift
1010 1002 1
init()
in Reference/google/protobuf/unittest_enormous_descriptor.pb.swift
1002 1 1
mutating func decodeMessage()
in Reference/generated_swift_names_fields.pb.swift
879 871 1
init?()
in Reference/generated_swift_names_enum_cases.pb.swift
875 871 1
init()
in Reference/generated_swift_names_fields.pb.swift
871 1 1
func traverse()
in Reference/fuzz_testing.pb.swift
852 295 1
func traverse()
in Reference/unittest_swift_naming.pb.swift
671 224 1
mutating func decodeMessage()
in Reference/fuzz_testing.pb.swift
423 320 1
init()
in FuzzTesting/Sources/FuzzCommon/fuzz_testing.pb.swift
260 1 1
init()
in Reference/fuzz_testing.pb.swift
260 1 1
func traverse()
in Reference/google/protobuf/unittest_lite.pb.swift
247 85 1
func traverse()
in Reference/unittest_swift_runtime_proto2.pb.swift
245 93 1
mutating func decodeMessage()
in Reference/google/protobuf/unittest_well_known_types.pb.swift
241 110 1
func traverse()
in Reference/google/protobuf/unittest.pb.swift
237 81 1
func traverse()
in Reference/unittest_swift_runtime_proto3.pb.swift
235 89 1
mutating func decodeMessage()
in Reference/unittest_swift_naming.pb.swift
232 224 1
init()
in Reference/unittest_swift_naming.pb.swift
224 3 1
mutating func decodeMessage()
in Reference/unittest_swift_runtime_proto2.pb.swift
219 117 1