flutter / engine
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 10,758 units with 121,524 lines of code in units (45.2% of code).
    • 68 very long units (10,722 lines of code)
    • 222 long units (14,945 lines of code)
    • 1,085 medium size units (32,868 lines of code)
    • 1,884 small units (27,585 lines of code)
    • 7,499 very small units (35,404 lines of code)
8% | 12% | 27% | 22% | 29%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cc10% | 10% | 27% | 24% | 26%
dart8% | 14% | 28% | 21% | 26%
java8% | 11% | 22% | 20% | 36%
mm6% | 7% | 27% | 24% | 33%
py3% | 20% | 34% | 21% | 19%
h0% | 4% | 10% | 11% | 73%
m0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
shell10% | 10% | 25% | 23% | 29%
lib7% | 14% | 28% | 22% | 27%
display_list16% | 14% | 22% | 14% | 32%
tools8% | 18% | 30% | 18% | 24%
testing6% | 13% | 33% | 18% | 28%
build23% | 20% | 10% | 26% | 19%
vulkan8% | 16% | 34% | 20% | 19%
runtime0% | 17% | 30% | 24% | 27%
flow0% | 6% | 32% | 28% | 32%
web_sdk0% | 11% | 63% | 12% | 12%
sky0% | 25% | 29% | 25% | 20%
flutter_frontend_server0% | 100% | 0% | 0% | 0%
fml0% | 1% | 23% | 26% | 49%
common0% | 0% | 43% | 26% | 29%
ci0% | 0% | 47% | 41% | 11%
assets0% | 0% | 26% | 36% | 37%
benchmarking0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
void convert()
in lib/web_ui/lib/src/engine/pointer_converter.dart
521 23 26
void Engine::Initialize()
in shell/platform/fuchsia/flutter/engine.cc
444 30 10
FlutterEngineResult FlutterEngineInitialize()
in shell/platform/embedder/embedder.cc
395 51 5
static void RenderWithAttributes()
in display_list/display_list_canvas_unittests.cc
340 7 3
LineBreakResult _unsafeNextLineBreak()
in lib/web_ui/lib/src/engine/text/line_breaker.dart
294 132 3
public AccessibilityNodeInfo createAccessibilityNodeInfo()
in shell/platform/android/io/flutter/view/AccessibilityBridge.java
288 98 1
bool RegisterApi()
in shell/platform/android/platform_view_android_jni_impl.cc
277 16 1
void GfxExternalViewEmbedder::SubmitFrame()
in shell/platform/fuchsia/flutter/gfx_external_view_embedder.cc
245 32 2
FileType identifyFile()
in tools/licenses/lib/filesystem.dart
202 149 2
static void RenderWithStrokes()
in display_list/display_list_canvas_unittests.cc
184 3 3
Settings SettingsFromCommandLine()
in shell/common/switches.cc
180 20 1
static void RenderWithSaveRestore()
in display_list/display_list_canvas_unittests.cc
180 1 3
void updateSemantics()
in shell/platform/android/io/flutter/view/AccessibilityBridge.java
179 62 3
public boolean performAction()
in shell/platform/android/io/flutter/view/AccessibilityBridge.java
175 41 3
void PointerDataPacketConverter::ConvertPointerData()
in lib/ui/window/pointer_data_packet_converter.cc
175 21 2
void GfxPlatformView::OnScenicEvent()
in shell/platform/fuchsia/flutter/gfx_platform_view.cc
171 33 1
static bool _isBreak()
in lib/web_ui/lib/src/engine/text/word_breaker.dart
165 48 2
void parseInstruction()
in lib/spirv/lib/src/transpiler.dart
165 59 0
void FlatlandExternalViewEmbedder::SubmitFrame()
in shell/platform/fuchsia/flutter/flatland_external_view_embedder.cc
161 17 2
SkEventTracer::Handle addTraceEvent()
in shell/common/skia_event_tracer_impl.cc
158 29 9