tensorflow / tfjs
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 4,875 units with 68,219 lines of code in units (55.1% of code).
    • 37 very long units (4,879 lines of code)
    • 185 long units (12,470 lines of code)
    • 747 medium size units (23,393 lines of code)
    • 864 small units (12,928 lines of code)
    • 3,042 very small units (14,549 lines of code)
7% | 18% | 34% | 18% | 21%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
ts7% | 17% | 35% | 19% | 20%
py10% | 23% | 35% | 16% | 13%
cc10% | 21% | 40% | 22% | 5%
js1% | 21% | 24% | 11% | 41%
tsx0% | 21% | 43% | 14% | 20%
h0% | 0% | 0% | 38% | 61%
java0% | 0% | 0% | 0% | 100%
m0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
tfjs-core8% | 9% | 36% | 20% | 25%
tfjs-converter14% | 14% | 30% | 20% | 19%
tfjs-backend-webgl7% | 20% | 31% | 19% | 19%
tfjs-layers6% | 7% | 45% | 17% | 23%
tfjs-vis24% | 25% | 24% | 13% | 11%
tfjs-backend-webgpu10% | 27% | 22% | 18% | 20%
tfjs-node3% | 14% | 27% | 17% | 37%
tfjs-backend-wasm2% | 24% | 37% | 23% | 11%
tfjs-backend-cpu5% | 46% | 30% | 11% | 5%
tfjs-inference50% | 0% | 30% | 13% | 5%
tfjs-react-native4% | 14% | 41% | 18% | 21%
tools94% | 0% | 0% | 0% | 5%
scripts0% | 43% | 25% | 19% | 11%
tfjs-data0% | 15% | 28% | 19% | 36%
ROOT0% | 100% | 0% | 0% | 0%
tfjs-tflite0% | 21% | 34% | 27% | 16%
tfjs0% | 16% | 44% | 22% | 15%
tfjs-automl0% | 0% | 55% | 23% | 21%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
constructor()
in tfjs-layers/src/engine/container.ts
252 44 1
def run()
in tfjs-converter/python/tensorflowjs/converters/wizard.py
231 18 1
def fold_batch_norms()
in tfjs-converter/python/tensorflowjs/converters/fold_batch_norms.py
176 37 1
export async function fitDataset()
in tfjs-layers/src/engine/training_dataset.ts
170 32 3
export function getMainHeaderString()
in tfjs-backend-webgpu/src/shader_preprocessor.ts
166 16 0
export function sliceInfo()
in tfjs-core/src/ops/slice_util.ts
159 48 9
private mapNode()
in tfjs-converter/src/operations/operation_mapper.ts
152 45 1
def get_arg_parser()
in tfjs-converter/python/tensorflowjs/converters/converter.py
146 13 0
export async function confusionMatrix()
in tfjs-vis/src/render/confusion_matrix.ts
146 21 3
function fusedDepthwiseConv2d_()
in tfjs-core/src/ops/fused/depthwise_conv2d.ts
145 11 24
export function runProgram()
in tfjs-backend-webgl/src/gpgpu_math.ts
145 38 5
function fusedConv2d_()
in tfjs-core/src/ops/fused/conv2d.ts
143 12 24
void conv2d()
in tfjs-backend-wasm/src/cc/conv2d_impl.cc
143 19 24
export async function heatmap()
in tfjs-vis/src/render/heatmap.ts
142 25 3
export async function linechart()
in tfjs-vis/src/render/linechart.ts
131 9 3
napi_value TFJSBackend::RunSavedModel()
in tfjs-node/binding/tfjs_backend.cc
128 14 5
function fusedMatMul_()
in tfjs-core/src/ops/fused/mat_mul.ts
126 19 15
void AssignOpAttr()
in tfjs-node/binding/tfjs_backend.cc
126 15 3
export function batchMatMulImpl()
in tfjs-backend-webgl/src/kernels/BatchMatMul_impl.ts
116 25 9
export function decodeWeights()
in tfjs-core/src/io/io_utils.ts
114 28 2