android / performance-samples
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 56 units with 395 lines of code in units (30.0% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 3 medium size units (79 lines of code)
    • 7 small units (103 lines of code)
    • 46 very small units (213 lines of code)
0% | 0% | 20% | 26% | 53%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
kt0% | 0% | 20% | 26% | 53%
cpp0% | 0% | 21% | 26% | 51%
ts0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ConstraintLayoutPerformance/app/src/main0% | 0% | 50% | 0% | 50%
MacrobenchmarkSample/macrobenchmark/src/main0% | 0% | 52% | 36% | 12%
BenchmarkNdkSample/benchmark/cpp/googlebenchmarkrunner0% | 0% | 30% | 19% | 50%
JankStatsSample/app/src/main0% | 0% | 0% | 41% | 58%
BenchmarkNdkSample/benchmark/cpp/benchmark0% | 0% | 0% | 46% | 53%
BenchmarkSample/ui/src/main0% | 0% | 0% | 0% | 100%
MacrobenchmarkSample/functions/src0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
override fun onCreate()
in ConstraintLayoutPerformance/app/src/main/java/com/example/android/perf/MainActivity.kt
31 1 1
fun nonExportedActivityScrollList()
in MacrobenchmarkSample/macrobenchmark/src/main/java/com/example/macrobenchmark/frames/NonExportedActivityBenchmark.kt
26 1 0
void ReportRuns()
in BenchmarkNdkSample/benchmark/cpp/googlebenchmarkrunner/googlebenchmarkrunner.cpp
22 3 1
fun scrollList()
in MacrobenchmarkSample/macrobenchmark/src/main/java/com/example/macrobenchmark/frames/FrameTimingBenchmark.kt
18 1 0
fun simulateJank()
in JankStatsSample/app/src/main/java/com/example/jankstats/tools/simulateJank.kt
17 4 2
override fun onCreate()
in JankStatsSample/app/src/main/java/com/example/jankstats/JankLoggingActivity.kt
14 1 1
override fun onScrollStateChanged()
in JankStatsSample/app/src/main/java/com/example/jankstats/MessageListFragment.kt
14 1 2
void getBenchmarks()
in BenchmarkNdkSample/benchmark/cpp/googlebenchmarkrunner/googlebenchmarkrunner.cpp
14 2 1
override fun onCreate()
in JankStatsSample/app/src/main/java/com/example/jankstats/JankAggregatorActivity.kt
13 1 1
static void BM_memcpy()
in BenchmarkNdkSample/benchmark/cpp/benchmark/SampleBenchmarks.cpp
13 2 1
override fun doInBackground()
in ConstraintLayoutPerformance/app/src/main/java/com/example/android/perf/MainActivity.kt
10 3 1
export function log()
in MacrobenchmarkSample/functions/src/logger.ts
10 4 2
fun bubbleSort()
in BenchmarkSample/ui/src/main/java/com/example/benchmark/ui/SortingAlgorithms.kt
9 4 1
fun bind()
in JankStatsSample/app/src/main/java/com/example/jankstats/MessageListAdapter.kt
9 1 1
override fun onCreateView()
in JankStatsSample/app/src/main/java/com/example/jankstats/MessageContentFragment.kt
8 1 3
override fun onCreateView()
in JankStatsSample/app/src/main/java/com/example/jankstats/MessageListFragment.kt
8 1 3
void notifyTestStarted()
in BenchmarkNdkSample/benchmark/cpp/googlebenchmarkrunner/googlebenchmarkrunner.cpp
8 2 0
override fun onProgressUpdate()
in ConstraintLayoutPerformance/app/src/main/java/com/example/android/perf/MainActivity.kt
7 1 1
static void BM_Atomic()
in BenchmarkNdkSample/benchmark/cpp/benchmark/SampleBenchmarks.cpp
7 2 1
override fun onCreate()
in BenchmarkSample/ui/src/main/java/com/example/benchmark/ui/MainActivity.kt
6 1 1