apple / foundationdb
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 19,041 units with 285,357 lines of code in units (69.8% of code).
    • 358 very long units (71,481 lines of code)
    • 740 long units (51,237 lines of code)
    • 2,225 medium size units (69,353 lines of code)
    • 2,821 small units (41,185 lines of code)
    • 12,897 very small units (52,101 lines of code)
25% | 17% | 24% | 14% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp27% | 20% | 25% | 12% | 13%
c36% | 20% | 23% | 12% | 7%
h10% | 10% | 19% | 18% | 40%
go15% | 10% | 28% | 16% | 28%
py9% | 9% | 21% | 15% | 44%
java3% | 4% | 26% | 29% | 36%
cs9% | 15% | 35% | 19% | 20%
rb0% | 9% | 24% | 12% | 53%
hpp0% | 5% | 46% | 22% | 25%
inc0% | 0% | 88% | 5% | 5%
js0% | 0% | 21% | 46% | 31%
cc0% | 0% | 11% | 48% | 40%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
fdbserver32% | 21% | 24% | 11% | 10%
fdbclient17% | 16% | 24% | 16% | 25%
fdbcli48% | 13% | 23% | 8% | 5%
fdbrpc19% | 13% | 22% | 17% | 26%
flow9% | 11% | 24% | 19% | 33%
fdbbackup39% | 21% | 27% | 8% | 3%
bindings7% | 7% | 26% | 21% | 36%
contrib12% | 11% | 20% | 15% | 40%
fdbmonitor24% | 22% | 19% | 20% | 12%
packaging40% | 9% | 21% | 20% | 8%
FDBLibTLS16% | 38% | 23% | 9% | 12%
fdbservice0% | 28% | 23% | 26% | 21%
layers0% | 8% | 20% | 21% | 49%
fdbkubernetesmonitor0% | 24% | 56% | 12% | 5%
recipes0% | 3% | 23% | 32% | 40%
flowbench0% | 0% | 0% | 42% | 57%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
SQLITE_PRIVATE int sqlite3VdbeExec()
in fdbserver/sqlite/sqlite3.amalgamation.c
3712 721 1
static void yy_reduce()
in fdbserver/sqlite/sqlite3.amalgamation.c
1129 468 2
int main()
in fdbbackup/backup.actor.cpp
1094 255 2
SQLITE_PRIVATE void sqlite3Pragma()
in fdbserver/sqlite/sqlite3.amalgamation.c
879 197 5
static int do_meta_command()
in fdbserver/sqlite/shell.c
825 273 2
void printStatus()
in fdbcli/StatusCommand.actor.cpp
803 230 4
ACTOR Future workerServer()
in fdbserver/worker.actor.cpp
798 83 16
ACTOR Future managementApiCorrectnessActor()
in fdbserver/workloads/SpecialKeySpaceCorrectness.actor.cpp
751 91 2
static uint128_wrapper get_cached_power()
in contrib/fmt-8.0.1/include/fmt/format-inl.h
700 6 1
ACTOR Future cli()
in fdbcli/fdbcli.actor.cpp
679 171 2
void ServerKnobs::initialize()
in fdbclient/ServerKnobs.cpp
627 457 3
void parseArgsInternal()
in fdbserver/fdbserver.actor.cpp
602 171 2
ACTOR static Future commitSubtree()
in fdbserver/VersionedBTree.actor.cpp
526 90 7
SQLITE_PRIVATE int sqlite3ExprCodeTarget()
in fdbserver/sqlite/sqlite3.amalgamation.c
497 151 3
int main()
in fdbserver/fdbserver.actor.cpp
480 112 2
SQLITE_PRIVATE void sqlite3VXPrintf()
in fdbserver/sqlite/sqlite3.amalgamation.c
454 144 4
bool betterMasterExists()
in fdbserver/ClusterController.actor.h
453 72 0
ACTOR Future blobGranuleUpdateFiles()
in fdbserver/BlobWorker.actor.cpp
443 78 3
static Bitmask codeOneLoopStart()
in fdbserver/sqlite/sqlite3.amalgamation.c
438 107 4
func()
in bindings/go/src/_stacktester/stacktester.go
434 104 1