pytorch / live
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 710 units with 7,943 lines of code in units (44.7% of code).
    • 1 very long units (108 lines of code)
    • 16 long units (1,041 lines of code)
    • 73 medium size units (2,301 lines of code)
    • 126 small units (1,818 lines of code)
    • 494 very small units (2,675 lines of code)
1% | 13% | 28% | 22% | 33%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
tsx7% | 27% | 45% | 9% | 10%
java0% | 11% | 20% | 24% | 43%
ts0% | 10% | 31% | 28% | 29%
js0% | 22% | 26% | 25% | 25%
swift0% | 0% | 25% | 27% | 46%
cpp0% | 0% | 55% | 20% | 24%
m0% | 0% | 0% | 0% | 100%
h0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
react-native-pytorch-core/example9% | 16% | 46% | 11% | 16%
react-native-pytorch-core/android0% | 13% | 18% | 23% | 45%
react-native-template-pytorch-live/template0% | 22% | 45% | 16% | 15%
torchlive-cli/src0% | 9% | 29% | 32% | 28%
react-native-pytorch-core/src0% | 33% | 0% | 15% | 50%
website/scripts0% | 46% | 0% | 13% | 40%
website/src0% | 16% | 38% | 32% | 11%
react-native-pytorch-core/ios0% | 0% | 25% | 27% | 47%
react-native-pytorch-core/cpp0% | 0% | 55% | 20% | 25%
react-native-template-ptl/template0% | 0% | 32% | 32% | 35%
website0% | 0% | 0% | 0% | 100%
torchlive-cli/scripts0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
export default function MNIST()
in react-native-pytorch-core/example/src/toolbox/models/MNIST.tsx
108 15 0
export function parse()
in react-native-pytorch-core/src/utils/CSSFontUtils.ts
100 38 1
export default function CanvasStarter()
in react-native-template-pytorch-live/template/src/toolbox/canvas/CanvasTransform.tsx
90 6 0
protected void register()
in react-native-pytorch-core/android/src/main/java/org/pytorch/rn/core/ml/processing/BaseIValuePacker.java
79 1 1
export default function UIStarter()
in react-native-template-pytorch-live/template/src/toolbox/ui/UIStarter.tsx
74 1 0
private void init()
in react-native-pytorch-core/android/src/main/java/org/pytorch/rn/core/camera/CameraView.java
68 5 0
private WritableArray decodeObjects()
in react-native-pytorch-core/android/src/main/java/org/pytorch/rn/core/ml/processing/BaseIValuePacker.java
66 9 3
export default function FastNeuralStyle()
in react-native-pytorch-core/example/src/toolbox/models/FastNeuralStyle.tsx
63 3 0
async function animate()
in react-native-pytorch-core/example/src/toolbox/apiTest/CanvasAnimation.tsx
63 8 1
async run()
in torchlive-cli/src/installers/android/AndroidEmulatorDeviceInstaller.ts
62 4 1
export default function NLPExample()
in react-native-pytorch-core/example/src/toolbox/models/Distilbert.tsx
59 5 0
void bindPreview()
in react-native-pytorch-core/android/src/main/java/org/pytorch/rn/core/camera/CameraView.java
55 9 1
private static Tensor doImageTransforms()
in react-native-pytorch-core/android/src/main/java/org/pytorch/rn/core/ml/processing/BaseIValuePacker.java
54 14 2
function importExamples()
in website/scripts/codegen-examples.js
53 7 0
export default function CanvasStarter()
in react-native-template-pytorch-live/template/src/toolbox/canvas/CanvasStarter.tsx
52 7 0
function runHealthCheck()
in torchlive-cli/src/cli-commands/Doctor.ts
52 10 2
export default function HttpTester()
in website/src/components/HttpTester.js
51 4 3
export default function CanvasImageSprite()
in react-native-pytorch-core/example/src/toolbox/apiTest/CanvasImageSprite.tsx
50 7 0
export default function CanvasGetImageData()
in react-native-pytorch-core/example/src/toolbox/apiTest/CanvasGetImageData.tsx
48 6 0
public void record()
in react-native-pytorch-core/android/src/main/java/org/pytorch/rn/core/audio/AudioModule.java
48 4 2