facebookexperimental / rust-shed
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 1,434 units with 13,980 lines of code in units (48.1% of code).
    • 3 very long units (447 lines of code)
    • 20 long units (1,312 lines of code)
    • 133 medium size units (3,965 lines of code)
    • 232 small units (3,375 lines of code)
    • 1,046 very small units (4,881 lines of code)
3% | 9% | 28% | 24% | 34%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
rs3% | 8% | 23% | 25% | 39%
py2% | 11% | 35% | 22% | 28%
c0% | 0% | 100% | 0% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
shed/facet32% | 30% | 21% | 6% | 9%
build/fbcode_builder2% | 11% | 36% | 22% | 28%
shed/hash_memo0% | 47% | 7% | 4% | 40%
shed/panichandler0% | 95% | 0% | 0% | 4%
shed/ascii_ext0% | 56% | 0% | 0% | 43%
shed/cached_config0% | 26% | 39% | 8% | 25%
shed/slog_glog_fmt0% | 12% | 33% | 25% | 28%
shed/futures_01_ext0% | 0% | 25% | 34% | 40%
shed/scuba_sample0% | 0% | 46% | 16% | 37%
shed/sorted_vector_map0% | 0% | 23% | 29% | 47%
shed/futures_ext0% | 0% | 37% | 34% | 28%
shed/async_compression0% | 0% | 30% | 13% | 56%
shed/quickcheck_arbitrary_derive0% | 0% | 53% | 46% | 0%
shed/chrome_trace0% | 0% | 63% | 19% | 16%
shed/netstring0% | 0% | 27% | 53% | 19%
shed/borrowed0% | 0% | 66% | 16% | 17%
shed/failure_ext0% | 0% | 17% | 38% | 43%
shed/perthread0% | 0% | 42% | 17% | 39%
shed/fbinit0% | 0% | 81% | 0% | 18%
shed/sql0% | 0% | 12% | 52% | 35%
shed/futures_stats0% | 0% | 20% | 41% | 37%
shed/cloned0% | 0% | 30% | 47% | 22%
shed/thrift_compiler0% | 0% | 40% | 59% | 0%
shed/serde_starlark0% | 0% | 0% | 22% | 77%
shed/shared_error0% | 0% | 0% | 79% | 20%
shed/tokio_shim0% | 0% | 0% | 45% | 54%
shed/tokio-uds-compat0% | 0% | 0% | 51% | 48%
shed/fbthrift_ext0% | 0% | 0% | 52% | 48%
shed/stats0% | 0% | 0% | 5% | 94%
shed/time_ext0% | 0% | 0% | 11% | 88%
shed/secure_utils0% | 0% | 0% | 54% | 45%
shed/lock_ext0% | 0% | 0% | 0% | 100%
shed/cachelib_stub0% | 0% | 0% | 0% | 100%
shed/bytes_ext0% | 0% | 0% | 0% | 100%
shed/memcache_stub0% | 0% | 0% | 0% | 100%
shed/trait_alias0% | 0% | 0% | 0% | 100%
shed/services0% | 0% | 0% | 0% | 100%
shed/codegen_includer_proc_macro0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
205 16 5
128 13 3
114 7 5
100 11 1
78 1 1
78 7 0
76 25 4
74 11 3
73 19 2
69 11 2
68 2 3
64 1 1
64 1 2
63 1 1
62 22 1
58 1 0
57 5 1
57 1 2
55 5 1
55 1 1
55 16 4
54 1 3
52 5 1
50 12 4
50 6 3
48 6 0
47 3 0
47 5 0
47 8 2
46 3 1
46 8 2
44 8 1
44 16 3
43 2 3
43 1 2
43 6 3
43 10 2
43 7 3
41 1 0
41 9 1
41 15 2
41 17 1
40 1 0
40 19 2
40 5 0
39 8 3
38 1 0
38 1 0
38 8 2
38 6 3