apple / swift-corelibs-libdispatch
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 87 units with 995 lines of code in units (2.2% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 15 medium size units (467 lines of code)
    • 12 small units (190 lines of code)
    • 60 very small units (338 lines of code)
0% | 0% | 46% | 19% | 33%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
c0% | 0% | 54% | 19% | 25%
h0% | 0% | 45% | 16% | 38%
d0% | 0% | 100% | 0% | 0%
cpp0% | 0% | 39% | 35% | 24%
cc0% | 0% | 0% | 100% | 0%
swift0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src0% | 0% | 74% | 8% | 17%
src/BlocksRuntime0% | 0% | 27% | 37% | 35%
private0% | 0% | 77% | 0% | 22%
src/event0% | 0% | 68% | 0% | 31%
src/shims0% | 0% | 0% | 71% | 28%
src/swift0% | 0% | 0% | 13% | 86%
src/firehose0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
50 4 7
42 3 3
41 1 1
static void _Block_byref_assign_copy()
in src/BlocksRuntime/runtime.c
38 7 3
register void()
in src/benchmark.c
36 5 1
34 1 3
33 6 3
30 4 1
case DISPATCH_CONTINUATION_TYPE()
in src/introspection.c
26 11 1
void _Block_object_assign()
in src/BlocksRuntime/runtime.c
25 9 3
probe queue__push()
in src/provider.d
24 1 6
24 5 1
22 2 3
void _Block_object_dispose()
in src/BlocksRuntime/runtime.c
21 9 2
21 9 0
20 6 1
void _Block_use_GC()
in src/BlocksRuntime/runtime.c
19 1 1
void _Block_release()
in src/BlocksRuntime/runtime.c
19 8 1
19 5 1
static void _dispatch_overlay_constructor()
in src/swift/DispatchStubs.cc
18 2 0