dart-lang / build
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 593 units with 9,136 lines of code in units (50.5% of code).
    • 5 very long units (761 lines of code)
    • 25 long units (1,731 lines of code)
    • 96 medium size units (2,923 lines of code)
    • 126 small units (1,858 lines of code)
    • 341 very small units (1,863 lines of code)
8% | 18% | 31% | 20% | 20%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
dart8% | 19% | 31% | 20% | 20%
js0% | 0% | 72% | 0% | 27%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
build_runner14% | 31% | 28% | 15% | 10%
build_web_compilers23% | 14% | 31% | 15% | 15%
_test_common53% | 0% | 12% | 0% | 34%
build_runner_core0% | 19% | 38% | 20% | 22%
build_modules0% | 22% | 36% | 32% | 8%
build_resolvers0% | 12% | 29% | 35% | 22%
build_daemon0% | 14% | 42% | 13% | 29%
build_test0% | 0% | 28% | 30% | 40%
build0% | 0% | 21% | 23% | 54%
build_vm_compilers0% | 0% | 77% | 22% | 0%
scratch_space0% | 0% | 42% | 22% | 35%
build_config0% | 0% | 0% | 47% | 52%
example0% | 0% | 0% | 62% | 37%
tool0% | 0% | 0% | 100% | 0%
_test0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
String _renderPerformance()
in build_runner/lib/src/server/server.dart
224 31 6
bool matches()
in _test_common/lib/matchers.dart
164 35 2
Stream _run()
in build_runner/lib/src/generate/watch_impl.dart
135 17 6
Future _createDevCompilerModule()
in build_web_compilers/lib/src/dev_compiler_builder.dart
132 21 12
Future _bootstrapDart2Js()
in build_web_compilers/lib/src/dart2js_bootstrap.dart
106 13 6
Future bootstrapDdc()
in build_web_compilers/lib/src/dev_compiler_bootstrap.dart
96 6 7
AssetNode _deserializeAssetNode()
in build_runner_core/lib/src/asset_graph/serialization.dart
94 9 1
FutureOr _run()
in build_runner/lib/src/entrypoint/run_script.dart
91 9 1
Future generateAndRun()
in build_runner/lib/src/build_script_generate/bootstrap.dart
88 10 3
Future watch()
in build_runner/lib/src/generate/watch_impl.dart
80 1 10
Future Function()
in build_runner_core/lib/src/asset_graph/graph.dart
80 21 1
Future prepareWorkspace()
in build_runner_core/lib/src/generate/build_definition.dart
78 8 0
Future _tryReadCachedAssetGraph()
in build_runner_core/lib/src/generate/build_definition.dart
78 13 0
Future _createKernel()
in build_modules/lib/src/kernel_builder.dart
75 6 12
Future build()
in build_runner/lib/src/generate/build.dart
74 1 10
Future _createMergedOutputDir()
in build_runner_core/lib/src/environment/create_merged_dir.dart
73 16 8
Future build()
in build_runner/lib/src/daemon/daemon_builder.dart
71 13 2
void _addBaseFlags()
in build_runner/lib/src/entrypoint/base_command.dart
69 1 1
Future _run()
in build_runner/lib/src/entrypoint/daemon.dart
68 9 1
Future _handleQuery()
in build_runner/lib/src/server/asset_graph_handler.dart
67 19 3