tensorflow / tfjs-examples
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 821 units with 12,608 lines of code in units (29.1% of code).
    • 5 very long units (690 lines of code)
    • 29 long units (1,956 lines of code)
    • 150 medium size units (4,583 lines of code)
    • 197 small units (2,928 lines of code)
    • 440 very small units (2,451 lines of code)
5% | 15% | 36% | 23% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts50% | 22% | 17% | 8% | 1%
tsx85% | 0% | 14% | 0% | 0%
js1% | 15% | 37% | 25% | 20%
py0% | 14% | 55% | 20% | 9%
java0% | 0% | 41% | 20% | 37%
m0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
interactive-visualizers54% | 15% | 16% | 12% | <1%
react-native31% | 0% | 26% | 10% | 30%
lstm-text-generation18% | 16% | 16% | 20% | 28%
translation19% | 26% | 31% | 12% | 9%
snake-dqn0% | 42% | 36% | 8% | 12%
visualize-convnet0% | 41% | 44% | 13% | <1%
sentiment0% | 22% | 40% | 23% | 13%
addition-rnn0% | 55% | 13% | 26% | 3%
addition-rnn-webworker0% | 53% | 14% | 28% | 3%
date-conversion-attention0% | 26% | 34% | 12% | 27%
quantization0% | 14% | 65% | 8% | 11%
jena-weather0% | 28% | 42% | 16% | 12%
mnist-acgan0% | 13% | 49% | 25% | 11%
cart-pole0% | 20% | 18% | 25% | 36%
intent-classifier0% | 10% | 37% | 30% | 21%
simple-object-detection0% | 20% | 47% | 20% | 11%
iris0% | 11% | 51% | 19% | 17%
iris-fitDataset0% | 14% | 41% | 26% | 17%
electron0% | 0% | 62% | 13% | 24%
mnist-transfer-cnn0% | 0% | 36% | 41% | 22%
fashion-mnist-vae0% | 0% | 35% | 36% | 28%
mnist0% | 0% | 51% | 30% | 18%
polynomial-regression0% | 0% | 60% | 18% | 20%
website-phishing0% | 0% | 33% | 20% | 46%
boston-housing0% | 0% | 34% | 32% | 33%
tsne-mnist-canvas0% | 0% | 43% | 28% | 28%
mnist-core0% | 0% | 42% | 24% | 33%
data-csv0% | 0% | 47% | 40% | 11%
polynomial-regression-core0% | 0% | 43% | 23% | 33%
baseball-node0% | 0% | 32% | 40% | 26%
mnist-node0% | 0% | 44% | 30% | 24%
mobilenet0% | 0% | 71% | 28% | 0%
gpu-pipeline0% | 0% | 13% | 48% | 37%
webcam-transfer-learning0% | 0% | 23% | 45% | 30%
data-generator0% | 0% | 10% | 49% | 40%
abalone-node0% | 0% | 43% | 56% | 0%
chrome-extension0% | 0% | 17% | 61% | 20%
custom-layer0% | 0% | 0% | 77% | 22%
getting-started0% | 0% | 0% | 0% | 100%
firebase-object-detection-node0% | 0% | 0% | 0% | 100%
angular-predictive-prefetching0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
export default function App()
in react-native/pose-detection/App.tsx
173 26 0
async runObjectDetector()
in interactive-visualizers/src/app/app.component.ts
140 18 2
export function setUpUI()
in lstm-text-generation/ui.js
132 20 0
async runImageSegmenter()
in interactive-visualizers/src/app/app.component.ts
131 20 2
async function readData()
in translation/translation.ts
114 13 1
96 1 0
export function renderSnakeGame()
in snake-dqn/snake_graphics.js
96 11 3
async function main()
in translation/translation.ts
95 5 0
async function run()
in visualize-convnet/index.js
83 12 0
async function run()
in visualize-convnet/main.js
77 10 0
async train()
in addition-rnn/index.js
76 7 3
async function init()
in mnist-acgan/index.js
75 7 0
async runImageClassifier()
in interactive-visualizers/src/app/app.component.ts
74 13 2
function parseArguments()
in sentiment/train.js
72 1 0
function renderCartPole()
in cart-pole/ui.js
71 4 2
async function main()
in sentiment/train.js
69 9 0
async function getDataIterator()
in intent-classifier/training/train_tagger.js
69 11 4
function parseArgs()
in lstm-text-generation/train_node.js
67 1 0
export async function train()
in snake-dqn/train.js
66 12 9
def read_data()
in translation/python/translation.py
65 18 0