microsoft / CNTK
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 9,009 units with 128,935 lines of code in units (57.6% of code).
    • 108 very long units (20,638 lines of code)
    • 335 long units (22,925 lines of code)
    • 1,074 medium size units (33,455 lines of code)
    • 1,597 small units (23,575 lines of code)
    • 5,895 very small units (28,342 lines of code)
16% | 17% | 25% | 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
cpp23% | 19% | 24% | 17% | 15%
h9% | 14% | 23% | 18% | 33%
py6% | 19% | 37% | 21% | 15%
hpp0% | 43% | 52% | 0% | 3%
cs0% | 0% | 23% | 28% | 48%
cc0% | 0% | 34% | 16% | 49%
java0% | 0% | 47% | 35% | 16%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Source/CNTKv2LibraryDll24% | 11% | 26% | 17% | 20%
Source/Readers17% | 24% | 22% | 16% | 20%
Source/SGDLib42% | 24% | 16% | 10% | 6%
Source/ComputationNetworkLib10% | 13% | 27% | 22% | 27%
Source/CNTK42% | 17% | 17% | 9% | 14%
bindings/python6% | 19% | 37% | 20% | 15%
Source/ActionsLib35% | 30% | 17% | 8% | 8%
Source/Math6% | 16% | 29% | 20% | 26%
Source/SequenceTrainingLib33% | 31% | 13% | 12% | 9%
Source/1BitSGD24% | 27% | 25% | 14% | 8%
Source/Common3% | 10% | 19% | 22% | 43%
Source/EvalDll0% | 15% | 26% | 25% | 32%
Source/PerformanceProfilerDll0% | 23% | 32% | 20% | 23%
bindings/csharp0% | 0% | 23% | 28% | 48%
Source/Extensibility0% | 0% | 41% | 37% | 20%
Scripts0% | 0% | 26% | 42% | 31%
bindings/java0% | 0% | 47% | 35% | 16%
Tutorials/NumpyInterop0% | 0% | 78% | 0% | 21%
Tutorials/HelloWorld-LogisticRegression0% | 0% | 0% | 88% | 11%
Tutorials/ImageHandsOn0% | 0% | 0% | 100% | 0%
Source/DelayLoadedExtensionsDll0% | 0% | 0% | 78% | 21%
PretrainedModels0% | 0% | 0% | 0% | 100%
Tools0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
FunctionPtr ONNXToCNTKHelper::CreateFunction()
in Source/CNTKv2LibraryDll/proto/onnx/ONNXToCNTK.cpp
984 192 5
void PrimitiveFunction::InferOutputs()
in Source/CNTKv2LibraryDll/PrimitiveFunction.cpp
860 293 1
ComputationNodeBasePtr CompositeFunction::CreateComputationNode()
in Source/CNTKv2LibraryDll/CompositeFunction.cpp
721 159 6
void NDLNodeEvaluatorImpl::Evaluate()
in Source/ActionsLib/NDLNetworkBuilder.cpp
624 145 3
void SGD::TrainOrAdaptModel()
in Source/SGDLib/SGD.cpp
614 144 7
size_t SGD::TrainOneEpoch()
in Source/SGDLib/SGD.cpp
506 112 23
void CNTKToONNXHelper::CopyAttributes()
in Source/CNTKv2LibraryDll/proto/onnx/CNTKToONNX.cpp
464 127 2
void MELScript::CallFunction()
in Source/CNTK/ModelEditLanguage.cpp
453 119 2
bool HTKMLFReader::GetMinibatchToTrainOrTest()
in Source/Readers/HTKMLFReader/HTKMLFReader.cpp
410 93 1
Variable ResolveFunction()
in Source/CNTKv2LibraryDll/BackCompat.cpp
392 98 2
void HTKMLFReader::PrepareForTrainingOrTesting()
in Source/Readers/HTKMLFReader/HTKMLFReader.cpp
382 69 1
std::vector CreateRNNConstantHelper()
in Source/CNTKv2LibraryDll/proto/onnx/ONNXToCNTK.cpp
355 61 5
void ComputationNetwork::SaveToDbnFile()
in Source/ComputationNetworkLib/ComputationNetwork.cpp
280 46 2
void estimate()
in Source/Readers/Kaldi2Reader/msra_mgram.h
277 73 3
void AggregateGradientsImpl()
in Source/1BitSGD/AllReduceDistGradAggregator.h
254 73 3
void HTKMLFReader::PrepareForTrainingOrTesting()
in Source/Readers/Kaldi2Reader/HTKMLFReader.cpp
254 33 1
static ConfigValuePtr Evaluate()
in Source/CNTK/BrainScript/BrainScriptEvaluator.cpp
245 66 4
bool getbatch()
in Source/Readers/HTKMLFReader/utterancesourcemulti.h
240 48 11
void CNTKToONNXHelper::ProcessInputs()
in Source/CNTKv2LibraryDll/proto/onnx/CNTKToONNX.cpp
235 81 7
void ComputationNode::WriteMinibatchWithFormatting()
in Source/ComputationNetworkLib/ComputationNode.cpp
226 75 17