microsoft / onnxruntime
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 14,497 units with 223,486 lines of code in units (47.1% of code).
    • 227 very long units (44,548 lines of code)
    • 614 long units (42,494 lines of code)
    • 1,942 medium size units (60,823 lines of code)
    • 2,400 small units (35,107 lines of code)
    • 9,314 very small units (40,514 lines of code)
19% | 19% | 27% | 15% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cc26% | 22% | 27% | 13% | 10%
py13% | 18% | 28% | 17% | 21%
h11% | 8% | 20% | 18% | 40%
cpp8% | 16% | 34% | 21% | 19%
cs20% | 11% | 24% | 20% | 23%
java11% | 9% | 31% | 14% | 32%
ts3% | 11% | 30% | 25% | 29%
c0% | 25% | 44% | 24% | 5%
mm0% | 0% | 37% | 10% | 51%
hpp0% | 0% | 7% | 9% | 83%
tsx0% | 0% | 0% | 59% | 40%
m0% | 0% | 0% | 0% | 100%
js0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
onnxruntime20% | 20% | 27% | 14% | 16%
orttraining26% | 16% | 25% | 16% | 14%
tools23% | 14% | 30% | 18% | 13%
csharp20% | 11% | 24% | 20% | 23%
winml8% | 13% | 28% | 23% | 25%
java10% | 15% | 28% | 18% | 26%
js2% | 14% | 31% | 23% | 27%
server13% | 16% | 37% | 18% | 13%
ROOT0% | 44% | 0% | 12% | 42%
include0% | 2% | 15% | 17% | 65%
objectivec0% | 0% | 0% | 11% | 88%
cgmanifests0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
void RegisterTrainingOpSchemas()
in orttraining/orttraining/core/graph/training_op_defs.cc
2627 115 0
void RegisterContribSchemas()
in onnxruntime/core/graph/contrib_ops/contrib_defs.cc
1994 136 0
Status RegisterOnnxOperatorKernels()
in onnxruntime/core/providers/cpu/cpu_execution_provider.cc
1108 3 1
static Status RegisterCudaKernels()
in onnxruntime/core/providers/cuda/cuda_execution_provider.cc
835 3 1
void RegisterQuantizationSchemas()
in onnxruntime/core/graph/contrib_ops/quantization_defs.cc
806 56 0
common::Status TensorrtExecutionProvider::Compile()
in onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc
772 157 2
void DataOps::populate_op_mode_supported()
in onnxruntime/core/providers/openvino/ov_versions/data_ops.cc
725 137 0
static Status RegisterRocmKernels()
in onnxruntime/core/providers/rocm/rocm_execution_provider.cc
700 3 1
inline AbstractOperatorDesc ConvertOperatorDesc()
in onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/GeneratedSchemaHelpers.h
636 157 1
public delegate IntPtr DOrtCreateTensorRTProviderOptions()
in csharp/src/Microsoft.ML.OnnxRuntime/NativeMethods.shared.cs
609 2 1
void addObjectMethods()
in onnxruntime/python/onnxruntime_pybind_state.cc
452 49 3
void addObjectMethodsForTraining()
in orttraining/orttraining/python/orttraining_pybind_state.cc
404 16 2
Status ParseArguments()
in orttraining/orttraining/models/bert/main.cc
388 51 4
std::unique_ptr CreateExecutionProviderInstance()
in onnxruntime/python/onnxruntime_pybind_state.cc
372 113 3
void RegisterBertSchemas()
in onnxruntime/core/graph/contrib_ops/contrib_defs.cc
343 15 0
def generate_build_tree()
in tools/ci_build/build.py
339 199 19
Status QLinearConv::Compute()
in onnxruntime/core/providers/cpu/quantization/qlinearconv.cc
335 46 1
auto OperatorTypeVisitor()
in onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/ApiTraits.h
321 159 3
Status PartialExecutor::Execute()
in onnxruntime/core/framework/orttraining_partial_executor.cc
311 53 7
Status MegatronTransformer::TransformBARTAttention()
in orttraining/orttraining/core/optimizer/megatron_transformer.cc
307 59 6