apple / indexstore-db
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 6,907 units with 45,011 lines of code in units (42.6% of code).
    • 12 very long units (2,476 lines of code)
    • 77 long units (5,123 lines of code)
    • 295 medium size units (8,937 lines of code)
    • 517 small units (7,314 lines of code)
    • 6,006 very small units (21,161 lines of code)
5% | 11% | 19% | 16% | 47%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp9% | 18% | 29% | 18% | 24%
inc15% | 12% | 30% | 22% | 18%
h0% | 2% | 6% | 13% | 77%
c0% | 38% | 26% | 19% | 14%
swift0% | 21% | 22% | 13% | 43%
py0% | 0% | 71% | 20% | 8%
mm0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
lib/LLVMSupport7% | 14% | 22% | 16% | 38%
lib/Index7% | 9% | 25% | 20% | 37%
lib/Database0% | 16% | 25% | 22% | 35%
include/llvm0% | 3% | 7% | 13% | 76%
Sources/IndexStoreDB0% | 57% | 0% | 10% | 31%
lib/CIndexStoreDB0% | 10% | 3% | 12% | 73%
lib/Support0% | 0% | 24% | 11% | 63%
Utilities0% | 0% | 71% | 20% | 8%
lib/Core0% | 0% | 18% | 4% | 76%
Sources/tibs0% | 0% | 76% | 23% | 0%
Sources/ISDBTibs0% | 0% | 41% | 0% | 58%
include/indexstore0% | 0% | 8% | 22% | 69%
Sources/ISDBTestSupport0% | 0% | 0% | 16% | 83%
include/IndexStoreDB0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
int llvm::sys::unicode::foldCharSimple()
in lib/LLVMSupport/Support/UnicodeCaseFold.cpp
541 283 1
static bool is_local_impl()
in lib/LLVMSupport/Support/Unix/Path.inc
466 104 1
bool CommandLineParser::ParseCommandLineOptions()
in lib/LLVMSupport/Support/CommandLine.cpp
235 77 4
void StoreUnitRepo::registerUnit()
in lib/Index/IndexDatastore.cpp
195 40 3
bool isPrintable()
in lib/LLVMSupport/Support/Unicode.cpp
189 3 1
std::string Triple::normalize()
in lib/LLVMSupport/Support/Triple.cpp
141 55 1
void IEEEFloat::toString()
in lib/LLVMSupport/Support/APFloat.cpp
138 45 4
StringRef ScalarNode::unescapeDoubleQuoted()
in lib/LLVMSupport/Support/YAMLParser.cpp
126 41 3
static bool Execute()
in lib/LLVMSupport/Support/Windows/Program.inc
125 24 7
static void getAvailableFeatures()
in lib/LLVMSupport/Support/Host.cpp
113 94 6
static void KnuthDiv()
in lib/LLVMSupport/Support/APInt.cpp
105 25 6
bool sys::getHostCPUFeatures()
in lib/LLVMSupport/Support/Host.cpp
102 90 1
typedef NTSTATUS()
in lib/Database/lmdb/mdb.c
99 11 1
static inline int charWidth()
in lib/LLVMSupport/Support/Unicode.cpp
98 4 1
static bool Execute()
in lib/LLVMSupport/Support/Unix/Program.inc
98 31 7
decl __attribute__()
in include/llvm/Support/Compiler.h
94 9 1
static void getAMDProcessorTypeAndSubtype()
in lib/LLVMSupport/Support/Host.cpp
94 32 5
decl __attribute__()
in lib/LLVMSupport/include/llvm/Support/Compiler.h
94 9 1
void SMDiagnostic::print()
in lib/LLVMSupport/Support/SourceMgr.cpp
93 28 4
int mdb_dbi_open()
in lib/Database/lmdb/mdb.c
92 26 4