microsoft / react-native-macos
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 26,757 units with 315,393 lines of code in units (60.3% of code).
    • 258 very long units (43,788 lines of code)
    • 639 long units (42,767 lines of code)
    • 2,523 medium size units (77,414 lines of code)
    • 4,364 small units (63,290 lines of code)
    • 18,973 very small units (88,134 lines of code)
13% | 13% | 24% | 20% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js21% | 16% | 26% | 18% | 16%
cpp11% | 14% | 25% | 22% | 26%
h5% | 5% | 15% | 18% | 54%
java5% | 9% | 24% | 21% | 38%
cc5% | 17% | 35% | 23% | 18%
ts22% | 12% | 38% | 9% | 15%
mm3% | 12% | 25% | 23% | 35%
m0% | 8% | 42% | 23% | 25%
py0% | 10% | 34% | 22% | 32%
rb0% | 31% | 42% | 10% | 15%
kt0% | 0% | 0% | 51% | 48%
pyx0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Libraries21% | 17% | 26% | 19% | 16%
ReactCommon16% | 12% | 21% | 18% | 31%
Folly4% | 8% | 20% | 22% | 43%
ReactAndroid5% | 9% | 24% | 21% | 38%
android-patches19% | 10% | 47% | 9% | 13%
double-conversion8% | 21% | 34% | 18% | 16%
glog2% | 15% | 30% | 24% | 26%
jest61% | 0% | 0% | 25% | 12%
packages0% | 17% | 18% | 17% | 45%
React0% | 11% | 32% | 22% | 33%
bots0% | 23% | 43% | 26% | 6%
local-cli0% | 18% | 37% | 19% | 24%
scripts0% | 7% | 57% | 20% | 14%
template0% | 0% | 54% | 14% | 31%
flow0% | 0% | 44% | 45% | 10%
ROOT0% | 0% | 0% | 0% | 100%
ReactTurboModuleCxx0% | 0% | 0% | 0% | 100%
jsc0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
bool FOLLY_EXPECTED_ID()
in Folly/folly/Expected.h
1047 162 1
static void YGNodelayoutImpl()
in ReactCommon/yoga/yoga/Yoga.cpp
736 141 15
class alignas()
in Folly/folly/concurrency/detail/ConcurrentHashMap-detail.h
517 67 1
jsi::Value UIManagerBinding::get()
in ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp
463 33 2
static void calculateShadowViewMutationsV2()
in ReactCommon/react/renderer/mounting/Differentiator.cpp
395 68 6
class XMLHttpRequest extends()
in Libraries/Network/XMLHttpRequest.js
371 58 1
void Binding::schedulerDidFinishTransaction()
in ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp
371 49 1
static void calculateShadowViewMutationsFlattener()
in ReactCommon/react/renderer/mounting/Differentiator.cpp
369 82 9
(function()()
in Libraries/Renderer/implementations/ReactFabric-dev.fb.js
332 1 1
jsi::Value JavaTurboModule::invokeJavaMethod()
in ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp
328 31 6
function completeWork()
in Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js
324 85 3
function completeWork()
in Libraries/Renderer/implementations/ReactNativeRenderer-dev.js
314 83 3
function completeWork()
in Libraries/Renderer/implementations/ReactFabric-dev.fb.js
312 81 3
function completeWork()
in Libraries/Renderer/implementations/ReactFabric-dev.js
311 81 3
function beginWork()
in Libraries/Renderer/implementations/ReactFabric-dev.js
310 57 3
function beginWork()
in Libraries/Renderer/implementations/ReactNativeRenderer-dev.js
310 57 3
extractEvents: function()
in Libraries/Renderer/implementations/ReactFabric-prod.fb.js
267 63 4
extractEvents: function()
in Libraries/Renderer/implementations/ReactFabric-prod.js
267 63 4
extractEvents: function()
in Libraries/Renderer/implementations/ReactFabric-profiling.fb.js
267 63 4
extractEvents: function()
in Libraries/Renderer/implementations/ReactFabric-profiling.js
267 63 4