pytorch / glow
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,331 units with 87,839 lines of code in units (64.5% of code).
    • 90 very long units (21,929 lines of code)
    • 261 long units (17,400 lines of code)
    • 800 medium size units (25,413 lines of code)
    • 839 small units (12,259 lines of code)
    • 2,341 very small units (10,838 lines of code)
24% | 19% | 28% | 13% | 12%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp26% | 20% | 29% | 13% | 9%
h9% | 9% | 18% | 18% | 43%
c19% | 17% | 46% | 4% | 11%
py0% | 10% | 31% | 31% | 27%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
lib/Backends27% | 21% | 29% | 11% | 8%
lib/LLVMIRCodeGen38% | 14% | 21% | 10% | 14%
lib/Importer35% | 25% | 25% | 9% | 3%
tools/ClassGen74% | 6% | 10% | 4% | 3%
torch_glow/src16% | 25% | 35% | 14% | 8%
lib/Graph18% | 9% | 28% | 21% | 21%
lib/Optimizer13% | 28% | 40% | 11% | 6%
lib/Runtime39% | 20% | 18% | 11% | 10%
lib/Partitioner31% | 26% | 33% | 7% | 2%
lib/Onnxifi43% | 21% | 12% | 10% | 11%
lib/IR31% | 6% | 18% | 22% | 20%
include/glow7% | 9% | 17% | 20% | 44%
tools/loader16% | 26% | 34% | 9% | 11%
lib/Base15% | 22% | 43% | 9% | 8%
lib/CodeGen27% | 16% | 36% | 10% | 9%
lib/Quantization9% | 36% | 32% | 15% | 7%
inference_engines/x-inference-engines19% | 17% | 46% | 4% | 11%
lib/Backend0% | 37% | 30% | 16% | 15%
utils/scripts0% | 18% | 33% | 35% | 12%
lib/Exporter0% | 10% | 33% | 35% | 20%
utils0% | 5% | 28% | 30% | 35%
lib/ExecutionContext0% | 30% | 0% | 27% | 42%
lib/Converter0% | 15% | 51% | 19% | 13%
lib/Support0% | 9% | 26% | 37% | 26%
tools/Debugger0% | 0% | 67% | 22% | 10%
lib/ExecutionEngine0% | 0% | 66% | 14% | 18%
torch_glow/utils0% | 0% | 31% | 28% | 40%
lib/PassManager0% | 0% | 32% | 43% | 24%
tools/IncludeBin0% | 0% | 100% | 0% | 0%
torch_glow0% | 0% | 37% | 14% | 48%
torch_glow/torch_glow0% | 0% | 26% | 17% | 56%
tools/png2bin0% | 0% | 0% | 100% | 0%
lib/Flags0% | 0% | 0% | 100% | 0%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
void LLVMIRGen::generateLLVMIRForInstr()
in lib/LLVMIRCodeGen/LLVMIRGen.cpp
1621 124 2
int main()
in tools/ClassGen/NodeGen.cpp
1501 2 2
int main()
in tools/ClassGen/InstrGen.cpp
1266 2 2
Error Caffe2ModelLoader::loadOperator()
in lib/Importer/Caffe2ModelLoader.cpp
1197 180 1
bool Interpreter::isOpSupported()
in lib/Backends/Interpreter/Interpreter.cpp
789 336 1
static NodeSupportLevels isNodeSupported()
in lib/Backends/NNPI/NNPI.cpp
697 260 1
Error OpenCLFunction::execute()
in lib/Backends/OpenCL/OpenCL.cpp
692 86 1
677 51 5
bool SinkCode::run()
in lib/Optimizer/GraphOptimizer/GraphOptimizer.cpp
470 79 2
bool LLVMBackend::isOpSupported()
in lib/LLVMIRCodeGen/LLVMBackend.cpp
459 216 1
Error Provisioner::provisionNetwork()
in lib/Runtime/Provisioner/Provisioner.cpp
399 68 1
void IRGenVisitor::post()
in lib/IR/IRGen.cpp
388 41 2
int Executor::executeNetwork()
in tools/loader/ExecutorCore.cpp
323 74 0
Error Caffe2ModelLoader::loadWeight()
in lib/Importer/Caffe2ModelLoader.cpp
306 56 1
Error HostManager::addNetwork()
in lib/Runtime/HostManager/HostManager.cpp
297 55 2
Error ONNXModelLoader::loadOperator()
in lib/Importer/ONNXModelLoader.cpp
285 99 1
void Function::createOnnxLSTM()
in lib/Graph/Graph.cpp
277 51 15
275 65 4
Error TFLiteModelLoader::loadOperator()
in lib/Importer/TFLiteModelLoader.cpp
235 76 2
Error fromDynamicImpl()
in torch_glow/src/GlowCompileSpec.h
233 55 2