apple / swift-corelibs-foundation
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 5,715 units with 88,775 lines of code in units (40.8% of code).
    • 82 very long units (14,395 lines of code)
    • 248 long units (16,862 lines of code)
    • 796 medium size units (25,012 lines of code)
    • 1,087 small units (15,779 lines of code)
    • 3,502 very small units (16,727 lines of code)
16% | 18% | 28% | 17% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c20% | 22% | 29% | 14% | 12%
swift1% | 6% | 26% | 28% | 36%
h4% | 2% | 5% | 25% | 60%
py0% | 22% | 14% | 25% | 36%
m0% | 49% | 38% | 0% | 12%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
CoreFoundation/String.subproj35% | 21% | 22% | 11% | 10%
CoreFoundation/Locale.subproj29% | 29% | 22% | 11% | 6%
CoreFoundation/URL.subproj21% | 26% | 28% | 16% | 7%
CoreFoundation/Parsing.subproj24% | 25% | 26% | 12% | 11%
CoreFoundation/PlugIn.subproj16% | 23% | 32% | 15% | 11%
CoreFoundation/RunLoop.subproj10% | 25% | 34% | 12% | 16%
CoreFoundation/NumberDate.subproj22% | 12% | 25% | 20% | 19%
CoreFoundation/StringEncodings.subproj20% | 21% | 27% | 21% | 8%
CoreFoundation/Base.subproj6% | 16% | 33% | 17% | 25%
Sources/Foundation3% | 4% | 21% | 21% | 49%
CoreFoundation/Stream.subproj5% | 12% | 51% | 15% | 14%
CoreFoundation/Collections.subproj1% | 11% | 34% | 25% | 26%
Darwin/Foundation-swiftoverlay-Tests1% | 8% | 31% | 30% | 27%
CoreFoundation/Preferences.subproj0% | 21% | 40% | 21% | 17%
Darwin/Foundation-swiftoverlay0% | 8% | 24% | 29% | 37%
lib0% | 22% | 14% | 25% | 36%
Sources/FoundationNetworking0% | 6% | 27% | 33% | 33%
CoreFoundation/Error.subproj0% | 17% | 18% | 22% | 41%
CoreFoundation/AppServices.subproj0% | 16% | 42% | 23% | 17%
Sources/Tools0% | 28% | 69% | 0% | 2%
Sources/BlocksRuntime0% | 0% | 33% | 36% | 30%
Sources/FoundationXML0% | 0% | 22% | 50% | 26%
bootstrap/x86_64-apple-darwin0% | 0% | 0% | 6% | 93%
Darwin/shims0% | 0% | 0% | 17% | 82%
DarwinCompatibilityTests0% | 0% | 0% | 55% | 45%
Sources/UUID0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
static CFIndex __CFCalendarGetOrdinalityOfUnit3()
in CoreFoundation/Locale.subproj/CFCalendar.c
703 165 4
static Boolean __CFStringAppendFormatCore()
in CoreFoundation/String.subproj/CFString.c
633 235 2
CF_PRIVATE bool __CFBinaryPlistCreateObjectFiltered()
in CoreFoundation/Parsing.subproj/CFBinaryPList.c
553 240 12
Boolean CFStringFindWithOptionsAndLocale()
in CoreFoundation/String.subproj/CFString.c
382 226 6
Boolean __CFStringDecodeByteStream3()
in CoreFoundation/String.subproj/CFStringEncodings.c
327 153 7
CFComparisonResult CFStringCompareWithOptionsAndLocale()
in CoreFoundation/String.subproj/CFString.c
304 211 5
CFIndex __CFStringEncodeByteStream()
in CoreFoundation/String.subproj/CFStringEncodings.c
270 119 9
static int32_t __CFRunLoopRun()
in CoreFoundation/RunLoop.subproj/CFRunLoop.c
266 73 5
void CFStringNormalize()
in CoreFoundation/String.subproj/CFString.c
263 92 2
static Boolean __CFCharacterSetEqual()
in CoreFoundation/String.subproj/CFCharacterSet.c
252 147 2
Boolean CFCalendarGetTimeRangeOfUnit()
in CoreFoundation/Locale.subproj/CFCalendar.c
245 110 5
static Boolean _CFBundleGrokFileType()
in CoreFoundation/PlugIn.subproj/CFBundle_Grok.c
230 338 9
CFTypeRef CFNumberFormatterCopyProperty()
in CoreFoundation/Locale.subproj/CFNumberFormatter.c
220 116 2
CF_INLINE Boolean __CFParseFormatSpec()
in CoreFoundation/String.subproj/CFString.c
220 107 7
void CFCharacterSetIntersect()
in CoreFoundation/String.subproj/CFCharacterSet.c
218 82 2
void CFNumberFormatterSetProperty()
in CoreFoundation/Locale.subproj/CFNumberFormatter.c
216 74 3
static void __CFDateFormatterSetProperty()
in CoreFoundation/Locale.subproj/CFDateFormatter.c
206 71 4
static Boolean parseXMLElement()
in CoreFoundation/Parsing.subproj/CFPropertyList.c
204 86 4
static CFRange __CFCalendarGetRangeOfUnit3()
in CoreFoundation/Locale.subproj/CFCalendar.c
202 86 4
func read()
in Sources/Foundation/NSURL.swift
197 111 2