firebase / leveldb
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 729 units with 7,984 lines of code in units (55.9% of code).
    • 2 very long units (239 lines of code)
    • 21 long units (1,424 lines of code)
    • 84 medium size units (2,591 lines of code)
    • 119 small units (1,679 lines of code)
    • 503 very small units (2,051 lines of code)
2% | 17% | 32% | 21% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cc3% | 18% | 34% | 21% | 21%
h0% | 9% | 0% | 12% | 77%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
db5% | 23% | 32% | 18% | 20%
doc/bench0% | 27% | 51% | 10% | 10%
table0% | 7% | 30% | 30% | 31%
util0% | 4% | 27% | 30% | 36%
helpers/memenv0% | 0% | 25% | 27% | 46%
port0% | 0% | 0% | 10% | 89%
include/leveldb0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
130 32 1
void Run()
in db/db_bench.cc
109 34 0
Status VersionSet::Recover()
in db/version_set.cc
98 22 0
89 28 1
bool Reader::ReadRecord()
in db/log_reader.cc
85 19 2
Status Version::Get()
in db/version_set.cc
81 18 4
void Write()
in doc/bench/db_bench_sqlite3.cc
78 12 6
75 17 3
73 17 0
void Run()
in doc/bench/db_bench_sqlite3.cc
70 18 0
67 7 1
Status ReadBlock()
in table/format.cc
66 10 4
65 12 2
Status DBImpl::Recover()
in db/db_impl.cc
65 17 1
void Run()
in doc/bench/db_bench_tree_db.cc
65 16 0
59 13 1
Status DumpTable()
in db/dumpfile.cc
58 9 3
Status BuildTable()
in db/builder.cc
58 12 6
void ScanTable()
in db/repair.cc
57 10 1
Status DBImpl::Write()
in db/db_impl.cc
56 16 2